A storage resource management method and device, a storage medium and an electronic device

By building an IoC container in the test environment and generating API object instances, the problems of chaotic API calls and high coupling of storage devices are solved, achieving low-coupling and high-cohesion storage resource management, reducing code maintenance difficulty and improving management efficiency.

CN114579308BActive Publication Date: 2026-07-10CHINA CONSTRUCTION BANK

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA CONSTRUCTION BANK
Filing Date
2022-03-03
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

In existing technologies, the API calling methods for storage devices are chaotic, highly coupled, and difficult to maintain. Once the business logic changes, the code needs to be rewritten.

Method used

An IoC container is pre-built in the test environment. Object instances are generated through the IoC container. Based on device information and keywords, the registration information and dependencies of the API are obtained. Reflection is then used to call the API for storage resource management.

Benefits of technology

It reduces coupling and code maintenance difficulty, improves code flexibility and management efficiency, reduces errors caused by manual operation, and enhances management quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114579308B_ABST
    Figure CN114579308B_ABST
Patent Text Reader

Abstract

The application provides a storage resource management method and device, a storage medium and an electronic device. When a storage resource management request is received, device information of a storage device corresponding to the storage resource management request and a keyword of an API to be called are determined. The device information and the keyword are input into an IoC container to obtain an object instance of the API to be called. The IoC container obtains registration information and a dependency relationship of the API to be called based on the device information and the keyword, and reflects the registration information and the dependency relationship to obtain the object instance of the API to be called. Based on the object instance, the API to be called is called to manage a storage resource corresponding to the storage resource management request in the storage device. It can be seen that, according to the application, the IoC container is pre-constructed in a test environment, the object instance is generated by the IoC container, the API is called, and thus the coupling degree and the difficulty of code maintenance are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of operation and maintenance technology, and in particular to a storage resource management method and apparatus, storage medium and electronic equipment. Background Technology

[0002] The test environment includes multiple storage devices, each with a complete API (Application Programming Interface). Resource management and other maintenance tasks for the storage devices in the test environment are typically completed by calling the API.

[0003] In existing technologies, API calls are typically made by directly constructing JSON (JavaScript Object Notation). However, due to the large number of storage devices and their complex mappings to hosts, direct calls result in a chaotic calling process, high coupling, and significant code maintenance difficulties. Furthermore, any changes to the business logic necessitate a complete rewrite of the implementation. Summary of the Invention

[0004] This application provides a storage resource management method, apparatus, storage medium, and electronic device, aiming to solve the problems of chaotic calling methods, high coupling, excessive code maintenance difficulty, and the need to rewrite the entire implementation method once the business logic changes.

[0005] To achieve the above objectives, this application provides the following technical solution:

[0006] A storage resource management method is applied to a test environment, wherein an IoC container is pre-built in the test environment, and the method includes:

[0007] When a storage resource management request is received, the device information of the storage device corresponding to the storage resource management request and the keyword of the API to be called are determined;

[0008] The device information and the keyword are input into the IoC container to obtain an object instance of the API to be called; wherein, the IoC container obtains the registration information and dependencies of the API to be called based on the device information and the keyword, and performs reflection on the registration information and the dependencies to obtain an object instance of the API to be called;

[0009] Based on the object instance, the API to be invoked is called to manage the storage resources in the storage device corresponding to the storage resource management request.

[0010] Optionally, in the above method, the IoC container obtains the registration information and dependencies of the API to be called based on the device information and the keyword, including:

[0011] The keyword is hashed to obtain index information; the index information is used to indicate the storage location of the registration information of the API to be called in a pre-built hash table, which pre-stores the registration information of each API associated with each storage device included in the test environment;

[0012] The hash table corresponding to the device information in each of the pre-constructed hash tables is determined as the target hash table;

[0013] The element corresponding to the index information among the elements included in the target hash table is determined as the target element;

[0014] Determine whether there exists a tuple corresponding to the keyword among the tuples included in the target element;

[0015] If there is a tuple corresponding to the keyword among the elements included in the target element, obtain the tuple corresponding to the keyword;

[0016] Based on the tuple corresponding to the keyword, obtain the registration information of the API to be called;

[0017] Based on the device information, configure the storage path environment variable, and based on the storage path environment variable, obtain the configuration file that stores the dependency relationship of the API to be called;

[0018] Based on the configuration file, obtain the dependencies of the API to be called.

[0019] Optionally, in the above method, determining whether there exists a tuple corresponding to the keyword among the tuples included in the target element includes:

[0020] Determine whether there exists a key in each tuple of the target element that matches the keyword;

[0021] If it exists, then it is determined that there is a tuple corresponding to the keyword in each tuple included in the target element;

[0022] If it does not exist, then it is determined that there is no tuple corresponding to the keyword among the tuples included in the target element.

[0023] Optionally, the process of pre-storing the registration information of each API associated with each storage device included in the test environment in the hash table, as described above, includes:

[0024] Obtain the registration information of each API associated with each storage device included in the test environment;

[0025] Retrieve keywords from the registration information for each API;

[0026] Hash the keywords in the registration information of each API to obtain the index information of each API;

[0027] For each API, a hash table corresponding to the storage device of the API is determined in a pre-built hash table. Based on the index information of the API, an element storing the registration information of the API is determined in the determined hash table. Based on the key of the API and the registration information, a tuple of the API is formed and the tuple is added to the determined element.

[0028] Optionally, the above method, after calling the API to be called based on the object instance to manage the storage resources in the storage device corresponding to the storage resource management request, further includes:

[0029] Delete the object instance.

[0030] Optionally, the above method, after calling the API to be called based on the object instance to manage the storage resources in the storage device corresponding to the storage resource management request, further includes:

[0031] The storage resources corresponding to the storage resource management request are stored in the storage device through a preset interface.

[0032] Optionally, the above method, after calling the API to be called based on the object instance to manage the storage resources in the storage device corresponding to the storage resource management request, further includes:

[0033] Obtain the operation logs of the test environment;

[0034] After receiving the instruction to print the operation log, the operation log is printed.

[0035] A storage resource management device is applied in a test environment, wherein an IoC container is pre-built in the test environment, and the device includes:

[0036] The determining unit is used to determine the device information of the storage device corresponding to the storage resource management request and the keyword of the API to be called when a storage resource management request is received;

[0037] An input unit is used to input the device information and the keyword into the IoC container to obtain an object instance of the API to be called; wherein, the IoC container obtains the registration information and dependency relationship of the API to be called based on the device information and the keyword, and reflects the registration information and the dependency relationship to obtain an object instance of the API to be called;

[0038] The management unit is used to call the API to be called based on the object instance to manage the storage resources in the storage device corresponding to the storage resource management request.

[0039] A storage medium storing an instruction set, wherein the instruction set, when executed by a processor, implements the storage resource management method described above.

[0040] An electronic device, comprising:

[0041] Memory, used to store at least one set of instructions;

[0042] A processor is configured to execute a set of instructions stored in the memory, thereby implementing the memory resource management method described above.

[0043] Compared with the prior art, this application has the following advantages:

[0044] This application provides a storage resource management method, apparatus, storage medium, and electronic device. Upon receiving a storage resource management request, the method determines the device information of the storage device corresponding to the request and the keyword of the API to be called. The device information and the keyword are input into an IoC container to obtain an object instance of the API to be called. The IoC container, based on the device information and the keyword, obtains the registration information and dependencies of the API to be called, and reflects the registration information and dependencies to obtain the object instance of the API to be called. Based on the object instance, the API to be called is invoked to manage the storage resources in the storage device corresponding to the storage resource management request. Therefore, this application's solution reduces coupling and code maintenance difficulty by pre-building an IoC container in the test environment and generating an object instance through the IoC container to call the API. Attached Figure Description

[0045] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0046] Figure 1 A method flowchart for a storage resource management method provided in this application;

[0047] Figure 2 A flowchart illustrating another method for storage resource management provided in this application;

[0048] Figure 3 A flowchart illustrating another method for storage resource management provided in this application;

[0049] Figure 4 A flowchart illustrating another method for storage resource management provided in this application;

[0050] Figure 5 A schematic diagram of a storage resource management device provided in this application;

[0051] Figure 6 This is a schematic diagram of the structure of an electronic device provided in this application. Detailed Implementation

[0052] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0053] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0054] It should be noted that the concepts of "first" and "second" mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0055] It should be noted that the terms "a" and "a plurality of" used in this application disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0056] This application can be used in a wide variety of general-purpose or special-purpose computing environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor devices, distributed computing environments including any of the above devices, etc.

[0057] In this embodiment, for ease of understanding, the relevant terms involved in this application are explained as follows:

[0058] SAN (Storage Area Network) uses Fibre Channel (FC) technology to connect storage arrays and server hosts through FC switches, establishing a dedicated area network for data storage.

[0059] NAS (Network Attached Storage) is based on Ethernet and uses TCP / IP to achieve data transmission, providing services such as file sharing for different server operating systems; NAS supports multiple storage protocols such as NFS and CIFS.

[0060] Inversion of Control (IoC) is a design principle in object-oriented programming used to reduce coupling between computer code. The most common method is called Dependency Injection (DI), and another method is Dependency Lookup. Through IoC, when an object is created, a control system (the IoC container) passes references to the objects it depends on to it. In other words, dependencies are injected into the object.

[0061] SAN storage devices are primarily used as data disks for virtual machines and physical machines as database servers. These disks include both all-flash and mechanical hard drives. Servers using SAN storage all employ a portzone mode with wwpn partitioning. This requires obtaining the storage's wwpn and the server's wwpn, and then using ITL rules to create zones. The ITL (Interested Transaction List) is a component within an Oracle data block used to record all transactions occurring within that block.

[0062] The SAN network equipment adopts a single-layer architecture. Considering the limited usage of SAN storage devices in the test environment, the conventional single-layer SAN network consisting of two switches was reduced to a single SAN switch. A SAN network with only one SAN switch reduces the complexity of the high-availability architecture.

[0063] NAS storage devices primarily provide datastore for ESXi resource pools, and also provide shared storage for virtual machines;

[0064] NAS storage uses logical ports with virtual LAN (VLAN), and the switch connected to the NAS needs to be in trunk mode; the NAS provides datastore protocols of NFS 3.0 and NFS 4.0.

[0065] A dedicated storage network is set up on the network for storage. This storage network can be a separate private network (VPC), a separate network segment, or a subnet, ensuring that the physical server and virtual server can communicate with the NAS's service IP.

[0066] This application provides a storage resource management method that can be applied in a test environment where an IoC container is built.

[0067] The IoC container is used to store information about the implemented functions and to emit object instances from the registration information.

[0068] The process of building an IoC container in a test environment includes:

[0069] Based on the default methods in the default programming language, an IoC container is constructed. For example, the default programming language can be Python, and the default methods can be Python's sys.__import, getattr(object, method=""), hasattr(object, name), and setattr(object, name, value), etc. Specifically, sys.__import is used for importing, getattr(object, method="") is used to retrieve object methods, hasattr(object, name) is used to retrieve object name attributes, and setattr(object, name, value) is used to set object name attributes.

[0070] In this embodiment, the IoC container includes an object definition component, a configuration management component, and an object management component. The object definition component is used to describe the registration information of each class (including but not limited to the class name, the methods corresponding to the class, and the properties of the methods); the configuration management component is used to describe the dependency relationships between classes; and the object management component generates specific objects (i.e., object instances) by using the data in the definition component and the configuration management component.

[0071] In this embodiment, the IoC container stores the registration information of each class using a hash table. The hash table can be a list, containing multiple elements, each of which is also a list. Each element contains at least one tuple, and each tuple is a key-value pair. The key in the key-value pair is the keyword of the class's registration information, and the value is the class's registration information. It should be noted that the registration information of classes corresponding to different storage devices is stored in different hash tables.

[0072] In this embodiment, see Figure 1 The process of storing the registration information for each class in a hash table includes the following steps:

[0073] S101. Obtain the registration information of each API associated with each storage device in the test environment.

[0074] In this embodiment, the registration information of each API associated with each storage device in the test environment is obtained. The storage devices include SAN storage devices and NAS storage devices, and each storage device is associated with multiple APIs.

[0075] S102. Obtain the keywords for the registration information of each API.

[0076] In this embodiment, keywords are used to obtain the registration information for each API.

[0077] S103. Hash the keywords of the registration information for each API to obtain the index information for each API.

[0078] In this embodiment, the keywords of the registration information for each API are hashed. Specifically, based on a preset hash function, the keywords of the registration information for each API are hashed to obtain the hash value of each API, which is also the index information of each API. The index information indicates the storage location of the API's registration information in the hash table.

[0079] S104. For each API, determine the hash table corresponding to the storage device of the API in the pre-built hash table, and based on the API's index information, determine the element storing the API's registration information in the determined hash table, and based on the API's key and registration information, form a tuple for the API, and add the tuple to the determined element.

[0080] In this embodiment, for each API, a hash table corresponding to the target storage device is determined in a pre-built hash table. The target storage device is the storage device corresponding to the API. In other words, the hash table corresponding to the storage device corresponding to the API in the pre-built hash table is determined. Specifically, the hash table corresponding to the storage device corresponding to the API in the pre-built hash table is determined based on the device information of the storage device corresponding to the API.

[0081] In this embodiment, for each API, based on the API's index information, the element storing the API's registration information is determined in the determined hash table. That is, based on the API's index information, the element corresponding to the index information is determined in the hash table corresponding to the target device.

[0082] In this embodiment, for each API, a tuple is formed based on the API's keywords and registration information, and the tuple is added to the determined elements. Specifically, the API's keywords are used as the keys of the tuple to be generated, and the API's registration information is used as the values. Based on the keys and values ​​of the tuples to be generated, the API tuple is generated and added to the determined elements.

[0083] The storage resource management method provided in this application calculates the index information of each keyword based on the keyword of each class and a preset hash function. The index information of each keyword is used to indicate the storage location of the registration information of the class corresponding to the keyword in the hash table. Based on the keyword and registration information of the class, a key-value pair to be written is generated. Based on the key index information, the storage location of the key-value pair to be written in the hash table is determined, and the key-value pair to be written is written to the storage location. Specifically, the key-value pair to be written is written to the end of the corresponding tuple by appending.

[0084] It should be noted that different keys may obtain the same index information, i.e., k1≠k2, and f(k1)=f(k2). For different keys corresponding to the same index information, each key is stored in the same element of the hash table, and the key-value pairs corresponding to different keys are stored as different tuples in the same element.

[0085] The flowchart of the storage resource management method provided in this application is as follows: Figure 2 As shown, it specifically includes:

[0086] S201. When a storage resource management request is received, determine the device information of the storage device corresponding to the storage resource management request and the keyword of the API to be called.

[0087] In this embodiment, a storage resource management request is received, wherein the storage resource management request may be a request triggered by the user through a preset function key.

[0088] In this embodiment, when a storage resource management request is received, the device information of the storage device corresponding to the storage resource management request and the keyword of the API to be called are determined.

[0089] The process of determining the device information of the storage device corresponding to the storage resource management request specifically includes: determining the storage device for storing the storage resource to be managed, and obtaining the device information of the storage device, wherein the device information includes, but is not limited to, the type and manufacturer of the storage device.

[0090] The process of determining the keyword of the API to be called corresponding to the storage resource management request specifically includes: determining the API to be called to manage the storage resource to be managed, and obtaining the keyword of the API to be called.

[0091] S202. Input the device information and keywords into the IoC container to obtain the object instance of the API to be called; wherein, the IoC container obtains the registration information and dependencies of the API to be called based on the device information and keywords, and reflects the registration information and dependencies to obtain the object instance of the API to be called.

[0092] In this embodiment, device information and keywords are input into the IoC container, processed by the IoC container, and an object instance of the API to be called is obtained.

[0093] In this example, the IoC container's processing procedure includes: the IoC container obtains the registration information and dependencies of the API to be called based on device information and keywords, and performs reflection on the registration information and dependencies to obtain the object instance of the API to be called.

[0094] In this embodiment, see Figure 3 The process by which the IoC container obtains the registration information and dependencies of the API to be called based on device information and keywords includes the following steps:

[0095] S301. Hash the keywords to obtain index information.

[0096] In this embodiment, the keywords are hashed to obtain index information. Specifically, the keywords are hashed based on a preset hash function to obtain index information.

[0097] S302. Determine the target hash table as the hash table corresponding to the device information in each of the pre-built hash tables.

[0098] In this embodiment, based on device information, a hash table corresponding to the device information in each pre-constructed hash table is determined, and the hash table corresponding to the device information in each hash table is determined as the target hash table. The device information includes, but is not limited to, the type and manufacturer of the storage device.

[0099] S303. Determine the element corresponding to the index information among all elements included in the target hash table as the target element.

[0100] In this embodiment, based on the index information, the element corresponding to the index information is located among the elements included in the target hash table, and the located element is determined as the target element.

[0101] S304. Determine whether there is a tuple corresponding to the keyword among the tuples included in the target element. If not, execute S305; if yes, execute S306.

[0102] In this embodiment, it is determined whether there is an element corresponding to the keyword in each tuple included in the target element. Specifically, it is determined whether there is a key matching the keyword in each key of each tuple included in the target element. If there is, it is determined that there is a tuple corresponding to the keyword in each tuple included in the target element; if not, it is determined that there is no tuple corresponding to the keyword in each tuple included in the target element.

[0103] S305. Generate an error message.

[0104] In this embodiment, if none of the tuples included in the target element contain a tuple corresponding to the keyword, an error message is generated. The error message is used to indicate that no information corresponding to the keyword exists.

[0105] S306. Obtain the tuple corresponding to the keyword.

[0106] In this embodiment, if there is a tuple corresponding to the keyword in each tuple of the target element, then the tuple corresponding to the keyword is obtained from the target tuple.

[0107] S307. Based on the tuple corresponding to the keyword, obtain the registration information of the API to be called.

[0108] In this embodiment, the registration information of the API to be called is obtained based on the tuple corresponding to the keyword. Specifically, the values ​​included in the tuple are obtained from the tuple corresponding to the keyword, and the values ​​included in the tuple are the registration information of the API to be called.

[0109] S308. Based on device information, configure storage path environment variables, and based on storage path environment variables, obtain the configuration file containing the dependency relationships of the API to be called.

[0110] In this embodiment, based on device information, a storage path environment variable is configured, and based on the storage path environment variable, the storage location of the configuration file storing the dependency relationship of the API to be called is located. Based on the located storage location, the configuration file (i.e., bean file) storing the dependency relationship of the API to be called is obtained.

[0111] S309. Obtain the dependency relationship of the API to be called based on the configuration file.

[0112] In this embodiment, the configuration file stores the dependencies of the API to be called, so that the dependencies of the API to be called can be obtained based on the configuration file.

[0113] In this embodiment, after obtaining the registration information and dependencies of the API to be called, the registration information and dependencies are reflected to obtain the object instance of the API to be called.

[0114] S203. Based on the object instance, call the API to be called to manage the storage resources in the storage device corresponding to the storage resource management request.

[0115] In this embodiment, based on the object instance, the API to be invoked is called to manage the storage resources in the storage device corresponding to the storage resource management request.

[0116] It should be noted that the specific process of managing the storage resources corresponding to the storage device and storage resource management request by calling the API based on the object instance is described in the existing technology and will not be repeated here.

[0117] The storage resource management method provided in this application, upon receiving a storage resource management request, determines the device information of the storage device corresponding to the request and the keyword of the API to be called; inputs the device information and the keyword into an IoC container to obtain an object instance of the API to be called; wherein, based on the device information and the keyword, the IoC container obtains the registration information and dependencies of the API to be called, and reflects the registration information and dependencies to obtain the object instance of the API to be called; based on the object instance, the API to be called is invoked to manage the storage resources in the storage device corresponding to the storage resource management request. It is evident that this application's solution, by pre-building an IoC container in the test environment, generates an object instance through the IoC container and invokes the API. Due to the low coupling and high cohesion characteristics of the IoC container, coupling and code maintenance difficulty are reduced. Furthermore, the automated execution of storage resource management, compared to manual repetitive execution, effectively avoids errors caused by manual operation, thereby improving efficiency and quality.

[0118] In this embodiment, the storage resource management method provided in this application embodiment may further include the following steps after step S203:

[0119] Delete an object instance.

[0120] The storage resource management method provided in this application embodiment can manage the storage resources in the storage device corresponding to the storage resource management request by calling the API to be called based on the object instance, and can also delete the object instance to realize the management of the life cycle of the object instance.

[0121] In this embodiment, the storage resource management method provided in this application embodiment may further include the following steps after step S203:

[0122] The storage resources corresponding to the storage resource management request are stored in the storage device through the preset interface.

[0123] In this embodiment, the storage resources corresponding to the storage resource management request in the storage device can be stored in the database. Specifically, the storage resources corresponding to the storage resource management request in the storage device can be stored in the database through a preset interface. For example, the database can be MySQL, and the preset interface can be the MySQL db interface.

[0124] In this embodiment, a connection pool is used to connect to the database, thereby improving data throughput.

[0125] The storage resource management method provided in this application embodiment can store the storage resources in the storage device corresponding to the storage resource management request.

[0126] See Figure 4 In this embodiment, the storage resource management method provided in this application embodiment may further include the following steps after step S203:

[0127] S401. Obtain the operation log of the test environment.

[0128] In this embodiment, the operation logs of the test environment are obtained.

[0129] S402. After receiving the instruction to print the operation log, print the operation log.

[0130] In this embodiment, a log printing function is added to the implementation methods of each component using the decoration method. Specifically:

[0131] (1) The function is passed as a parameter into the decorator.

[0132] (2) Define a function inside the decorator to handle the function passed in as a parameter, and add a function to print logs inside this function.

[0133] (3) Return the function defined within this decorator.

[0134] In this embodiment, a function is defined within the decorator, and the functionality to print logs is added within this function. The function receives a command to print the operation log and passes this command to the decorator via parameters, allowing the function within the decorator to print the operation log.

[0135] It should be noted that although the operations are described in a specific order, this should not be interpreted as requiring these operations to be executed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous.

[0136] It should be understood that the various steps described in the method embodiments disclosed in this application may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this application is not limited in this respect.

[0137] and Figure 1 Corresponding to the method described above, this application also provides a storage resource management device, applied in a test environment, for use in... Figure 2 The specific implementation of the method is shown in the following structural diagram. Figure 5 As shown, it specifically includes:

[0138] The determining unit 501 is used to determine the device information of the storage device corresponding to the storage resource management request and the keyword of the API to be called when a storage resource management request is received;

[0139] Input unit 502 is used to input the device information and the keyword into the IoC container to obtain an object instance of the API to be called; wherein, the IoC container obtains the registration information and dependency relationship of the API to be called based on the device information and the keyword, and reflects the registration information and the dependency relationship to obtain an object instance of the API to be called;

[0140] The management unit 503 is used to call the API to be called based on the object instance to manage the storage resources in the storage device corresponding to the storage resource management request.

[0141] In the storage resource management device provided in this application embodiment, an IoC container is pre-built in the test environment, thereby generating object instances through the IoC container and calling APIs. Because the IoC container has the characteristics of low coupling and high cohesion, it reduces coupling and the difficulty of code maintenance. Furthermore, it automates storage resource management, effectively avoiding errors caused by manual repetitive execution compared to manual operations, thus improving efficiency and quality.

[0142] In one embodiment of this application, based on the foregoing scheme, when the IoC container obtains the registration information and dependencies of the API to be called based on the device information and the keyword, the input unit 502 is specifically used for:

[0143] The keyword is hashed to obtain index information; the index information is used to indicate the storage location of the registration information of the API to be called in a pre-built hash table, which pre-stores the registration information of each API associated with each storage device included in the test environment;

[0144] The hash table corresponding to the device information in each of the pre-constructed hash tables is determined as the target hash table;

[0145] The element corresponding to the index information among the elements included in the target hash table is determined as the target element;

[0146] Determine whether there exists a tuple corresponding to the keyword among the tuples included in the target element;

[0147] If there is a tuple corresponding to the keyword among the elements included in the target element, obtain the tuple corresponding to the keyword;

[0148] Based on the tuple corresponding to the keyword, obtain the registration information of the API to be called;

[0149] Based on the device information, configure the storage path environment variable, and based on the storage path environment variable, obtain the configuration file that stores the dependency relationship of the API to be called;

[0150] Based on the configuration file, obtain the dependencies of the API to be called.

[0151] In one embodiment of this application, based on the foregoing scheme, when the input unit 502 determines whether there is a tuple corresponding to the keyword among the tuples included in the target element, it is specifically used for:

[0152] Determine whether there exists a key in each tuple of the target element that matches the keyword;

[0153] If it exists, then it is determined that there is a tuple corresponding to the keyword in each tuple included in the target element;

[0154] If it does not exist, then it is determined that there is no tuple corresponding to the keyword among the tuples included in the target element.

[0155] In one embodiment of this application, based on the foregoing scheme, when the input unit 502 pre-stores the registration information of each API associated with each storage device included in the test environment in the hash table, it is specifically used for:

[0156] Obtain the registration information of each API associated with each storage device included in the test environment;

[0157] Retrieve keywords from the registration information for each API;

[0158] Hash the keywords in the registration information of each API to obtain the index information of each API;

[0159] For each API, a hash table corresponding to the storage device of the API is determined in a pre-built hash table. Based on the index information of the API, an element storing the registration information of the API is determined in the determined hash table. Based on the key of the API and the registration information, a tuple of the API is formed and the tuple is added to the determined element.

[0160] In one embodiment of this application, based on the foregoing solution, it can also be configured as follows:

[0161] The deletion unit is used to delete the object instance.

[0162] In one embodiment of this application, based on the foregoing solution, it can also be configured as follows:

[0163] The storage unit is used to store the storage resources corresponding to the storage resource management request in the storage device through a preset interface.

[0164] In one embodiment of this application, based on the foregoing solution, it can also be configured as follows:

[0165] The acquisition unit is used to acquire the operation logs of the test environment;

[0166] A printing unit is used to print the operation log after receiving a printing instruction for the operation log.

[0167] This application also provides a storage medium storing an instruction set, wherein the storage resource management method disclosed in any of the above embodiments is executed when the instruction set is run.

[0168] This application also provides an electronic device, the structural schematic diagram of which is shown below. Figure 6 As shown, it specifically includes a memory 601 for storing at least one set of instructions; and a processor 602 for executing the set of instructions stored in the memory, thereby implementing the storage resource management method disclosed in any of the embodiments above by executing the set of instructions.

[0169] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

[0170] While several specific implementation details are included in the foregoing discussion, these should not be construed as limiting the scope of the disclosure herein. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0171] The above description is merely a preferred embodiment disclosed in this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of disclosure in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

Claims

1. A storage resource management method, characterized in that, Applied to a test environment, wherein an IoC container is pre-built in the test environment, the method includes: When a storage resource management request is received, the storage device for the storage resource to be managed is determined, the device information of the storage device is obtained, and the API to be called to manage the storage resource is determined, and the keyword of the API to be called is obtained; wherein, the device information includes at least the type and manufacturer of the storage device; the keyword is the keyword of the registration information of the API to be called; The device information and the keyword are input into the IoC container to obtain an object instance of the API to be called; wherein, the IoC container obtains the registration information and dependencies of the API to be called based on the device information and the keyword, and performs reflection on the registration information and the dependencies to obtain an object instance of the API to be called; Based on the object instance, the API to be invoked is called to manage the storage resources in the storage device corresponding to the storage resource management request; The IoC container obtains the registration information and dependencies of the API to be called based on the device information and the keyword, including: hashing the keyword to obtain index information; the index information is used to indicate the storage location of the registration information of the API to be called in a pre-built hash table, the hash table pre-stores the registration information of each API associated with each storage device included in the test environment; determining the hash table corresponding to the device information in each pre-built hash table as the target hash table; determining the element corresponding to the index information in each element included in the target hash table as the target element; determining whether there is a tuple corresponding to the keyword in each tuple included in the target element; if there is a tuple corresponding to the keyword in each element included in the target element, obtaining the tuple corresponding to the keyword; obtaining the registration information of the API to be called based on the tuple corresponding to the keyword; configuring storage path environment variables based on the device information, and obtaining the configuration file storing the dependencies of the API to be called based on the storage path environment variables; obtaining the dependencies of the API to be called based on the configuration file.

2. The method according to claim 1, characterized in that, The step of determining whether there exists a tuple corresponding to the keyword among the tuples included in the target element includes: Determine whether there exists a key in each tuple of the target element that matches the keyword; If it exists, then it is determined that there is a tuple corresponding to the keyword in each tuple included in the target element; If it does not exist, then it is determined that there is no tuple corresponding to the keyword among the tuples included in the target element.

3. The method according to claim 1, characterized in that, The process of pre-storing the registration information of each API associated with each storage device included in the test environment in the hash table includes: Obtain the registration information of each API associated with each storage device included in the test environment; Retrieve keywords from the registration information for each API; Hash the keywords in the registration information of each API to obtain the index information of each API; For each API, a hash table corresponding to the storage device of the API is determined in a pre-built hash table. Based on the index information of the API, an element storing the registration information of the API is determined in the determined hash table. Based on the key of the API and the registration information, a tuple of the API is formed and the tuple is added to the determined element.

4. The method according to claim 1, characterized in that, After the step of calling the API to be called based on the object instance to manage the storage resources in the storage device corresponding to the storage resource management request, it further includes: Delete the object instance.

5. The method according to claim 1, characterized in that, After the step of calling the API to be called based on the object instance to manage the storage resources in the storage device corresponding to the storage resource management request, it further includes: The storage resources corresponding to the storage resource management request are stored in the storage device through a preset interface.

6. The method according to claim 1, characterized in that, After the step of calling the API to be called based on the object instance to manage the storage resources in the storage device corresponding to the storage resource management request, it further includes: Obtain the operation logs of the test environment; After receiving the instruction to print the operation log, the operation log is printed.

7. A storage resource management device, characterized in that, The apparatus is used in a test environment, wherein an IoC container is pre-built in the test environment, and the apparatus includes: The determining unit is configured to, upon receiving a storage resource management request, determine the storage device for the storage resource to be managed, obtain the device information of the storage device, determine the API to be invoked for managing the storage resource, and obtain the keyword of the API to be invoked; wherein, the device information includes at least the type and manufacturer of the storage device; and the keyword is the keyword of the registration information of the API to be invoked. An input unit is used to input the device information and the keyword into the IoC container to obtain an object instance of the API to be called; wherein, the IoC container obtains the registration information and dependency relationship of the API to be called based on the device information and the keyword, and reflects the registration information and the dependency relationship to obtain an object instance of the API to be called; The management unit is used to call the API to be called based on the object instance to manage the storage resources in the storage device corresponding to the storage resource management request; When the IoC container obtains the registration information and dependencies of the API to be called based on the device information and the keyword, the input unit is specifically configured to: perform hash processing on the keyword to obtain index information; the index information is used to indicate the storage location of the registration information of the API to be called in a pre-built hash table, the hash table pre-stores the registration information of each API associated with each storage device included in the test environment; determine the hash table corresponding to the device information in each pre-built hash table as the target hash table; determine the element corresponding to the index information in each element included in the target hash table as the target element; determine whether there is a tuple corresponding to the keyword in each tuple included in the target element; if there is a tuple corresponding to the keyword in each element included in the target element, obtain the tuple corresponding to the keyword; obtain the registration information of the API to be called based on the tuple corresponding to the keyword; configure the storage path environment variable based on the device information, and obtain the configuration file storing the dependencies of the API to be called based on the storage path environment variable; obtain the dependencies of the API to be called based on the configuration file.

8. A storage medium, characterized in that, The storage medium stores an instruction set, wherein when the instruction set is executed by the processor, it implements the storage resource management method as described in any one of claims 1-6.

9. An electronic device, characterized in that, include: Memory, used to store at least one set of instructions; A processor is configured to execute a set of instructions stored in the memory, thereby implementing the storage resource management method as described in any one of claims 1-6.