A disk processing method, apparatus, device and medium
By obtaining disk editing instructions in the virtualization platform, determining the target disk list and adding corresponding attributes, and automatically assigning addresses and disk letters, the cumbersome problems of disk editing in the existing technology are solved, and efficient disk processing is achieved.
Patent Information
- Application Number
- CN202211295573.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-21
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2042-10-21
AI Technical Summary
When the prior art performs complex editing of disks in virtualization platforms, independent operations are required, resulting in cumbersome operations, and it is difficult to add, delete and change disk properties at the same time.
By obtaining disk editing instructions, determining the target disk list, and adding unchanged, changed, added and deleted attributes to the disk based on the comparison results, automatically allocating the disk address and disk letters to realize the corresponding processing operations of the disk.
It supports users to perform complex disk operations at the same time, automatically complete disk address and disk letter allocation, improving the efficiency and convenience of disk editing.
Smart Images

Figure CN115576490B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of virtualization platforms, and particularly to a disk processing method, device, equipment, and medium. Background Art
[0002] Disks are very important components for any computer because they carry out data storage work. Without disks, a computer cannot run. Similarly, disks are also very important in virtualization platforms. For a virtualized computer, when there is not enough disk space, it can be increased; when there are too many disks, they can also be deleted to achieve reasonable resource allocation; and the disk attributes that do not meet the requirements can also be changed, such as the disk size.
[0003] The existing technologies only perform single disk technology operations, such as adding, deleting, and editing disks. Each operation type needs to be operated separately. In some scenarios, when it is necessary to perform operations such as deleting, adding, and changing the disks of a virtual machine simultaneously, and since various restrictions, validations, power-on operations, and power-off operations are also involved, it will be rather cumbersome for users to perform complex disk editing.
[0004] As can be seen from the above, in the process of complex disk editing, how to avoid the inconvenience in operation during complex editing caused by the need for independent operation of operation types is a problem to be solved in this field. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to provide a disk processing method, device, equipment, and medium, which can ensure accurate changes in the number and attributes of disks at the platform and underlying levels during complex disk editing, and can also accurately allocate disk addresses and disk drive letters for disks. The specific solutions are as follows:
[0006] In a first aspect, the present application discloses a disk processing method, including:
[0007] Obtain a disk editing instruction, and determine a target disk list based on the disk editing instruction;
[0008] Compare the target disk list with the original disk list to add corresponding disk operation attributes to all disks in the target disk list and the original disk list based on the comparison result; the disk operation attributes are unchanged attribute, changed attribute, added attribute, and deleted attribute;
[0009] Allocate disk addresses and disk drive letters for all disks based on the respective disk operation attributes of all disks;
[0010] Perform corresponding disk processing operations on all disks based on the respective disk operation attributes of all disks.
[0011] Optionally, after determining the target disk list based on the disk editing instruction, the method further includes:
[0012] Integrate the target disk list with the original disk list and store them in a preset container.
[0013] Optionally, comparing the target disk list with the original disk list to add corresponding disk operation attributes to all disks in the target disk list and the original disk list includes:
[0014] Determine the disks with the same disk capacity, disk format, and disk attributes in the target disk list and the original disk list as the first target disks, and add disk operation attributes with unchanged attributes to the first target disks;
[0015] Determine the disks with the same disk capacity and disk format but different disk attributes in the target disk list and the original disk list as the second target disks, and add disk operation attributes with changed attributes to the first target disks;
[0016] Determine the disks included in the target disk list but not in the original disk list as the third target disks, and add disk operation attributes with added attributes to the third target disks;
[0017] Determine the disks included in the original disk list but not in the target disk list as the fourth target disks, and add disk operation attributes with deletion attributes to the fourth target disks.
[0018] Optionally, allocating disk addresses and disk drive letters to all disks based on the disk operation attributes corresponding to all disks includes:
[0019] Based on the disk operation attributes corresponding to all disks and using the disk addresses in the preset disk address constant pool, allocate disk addresses to all disks;
[0020] Based on the disk operation attributes corresponding to all disks and using the disk drive letters in the preset disk drive letter constant pool, allocate disk drive letters to all disks.
[0021] Optionally, in the process of allocating disk addresses to all disks based on the disk operation attributes corresponding to all disks and using the disk addresses in the preset disk address constant pool, it includes:
[0022] Delete the disk addresses corresponding to the disks with disk operation attributes of changed attributes and unchanged attributes from the preset disk address constant pool;
[0023] The disk address stored in the preset disk address constant pool is used to allocate a disk address for the disk whose disk operation attribute is a newly added attribute.
[0024] Optionally, allocating disk drive letters to all disks based on the disk operation attributes corresponding to all disks and using disk drive letters in a preset disk drive letter constant pool includes:
[0025] Determine a first drive letter from a preset disk drive letter constant pool, traverse the disks in the target disk list to determine a boot disk in the target disk list, and then assign the first drive letter to the boot disk;
[0026] Remove the disk drive letters corresponding to the disks whose disk operation attributes are unchanged and changed from the preset disk drive letter constant pool, and add the disk drive letters corresponding to the disks whose disk operation attributes are deleted to the preset disk drive letter constant pool;
[0027] A disk drive letter stored in a preset disk drive letter constant pool is used to assign a disk drive letter to a disk whose disk operation attribute is to add an attribute.
[0028] Optionally, performing corresponding disk processing operations on all disks based on the disk operation attributes corresponding to all disks respectively includes:
[0029] Using the preset operation interface, modify the information of the disk whose disk operation attribute is to change the attribute, and save the modified information into the preset database;
[0030] Deleting the disk whose disk operation attribute is the deletion attribute by using the preset operation interface, releasing the disk lock corresponding to the disk whose disk operation attribute is the deletion attribute, deleting the disk data and volume data of the corresponding disk in the preset database, and canceling the corresponding relationship between the disk data and the volume data;
[0031] The disk with the disk operation attribute of adding attributes is created by using the preset operation interface, and the disk data and volume data are recorded for the created disk in the preset database, and the corresponding relationship between the disk data and the volume data is saved, and then the created disk is mounted to the current virtual machine.
[0032] In a second aspect, the present application discloses a disk processing device, comprising:
[0033] A target disk list determination module, used for obtaining a disk editing instruction and determining a target disk list based on the disk editing instruction;
[0034] A disk operation attribute adding module, configured to compare the target disk list with the original disk list, and add corresponding disk operation attributes to all disks in the target disk list and the original disk list based on the comparison result; the disk operation attributes are unchanged attribute, changed attribute, added attribute, and deleted attribute;
[0035] A disk address and disk drive letter allocation module, configured to allocate disk addresses and disk drive letters to all the disks based on the disk operation attributes corresponding to each of the all disks;
[0036] A disk processing module, configured to perform corresponding disk processing operations on all the disks based on the disk operation attributes corresponding to each of the all disks.
[0037] In a third aspect, the present application discloses an electronic device, including:
[0038] A memory, configured to store a computer program;
[0039] A processor, configured to execute the computer program to implement the foregoing disk processing method.
[0040] In a fourth aspect, the present application discloses a computer storage medium, configured to store a computer program; wherein, when the computer program is executed by a processor, the steps of the foregoing disclosed disk processing method are implemented.
[0041] In the present application, first, a disk editing instruction is obtained, and a target disk list is determined based on the disk editing instruction; the target disk list is compared with the original disk list, and corresponding disk operation attributes are added to all disks in the target disk list and the original disk list based on the comparison result; the disk operation attributes are unchanged attribute, changed attribute, added attribute, and deleted attribute; disk addresses and disk drive letters are allocated to all the disks based on the disk operation attributes corresponding to each of the all disks; corresponding disk processing operations are performed on all the disks based on the disk operation attributes corresponding to each of the all disks. In this way, the present application accepts the user's disk editing instruction, compares the target disk list determined based on the disk editing instruction with the original disk list, adds disk operation attributes to all disks based on the comparison result, then performs address allocation and drive letter allocation on the disks, and processes the disks based on the disk operation attributes. The present invention can support the user to perform operations such as adding, deleting, and editing disks simultaneously by automatically setting four disk operation attributes for the disks, and the present invention can automatically complete the processes of disk address allocation and disk drive letter allocation when the user performs complex disk operations, which facilitates the user's operation and improves the disk editing efficiency. Description of the Drawings
[0042] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to the provided drawings.
[0043] Figure 1 Flowchart of a disk processing method provided by this application;
[0044] Figure 2 Flowchart of a specific disk processing method provided by this application;
[0045] Figure 3 Schematic structural diagram of a disk processing device provided by this application;
[0046] Figure 4 Structural diagram of an electronic device provided by this application. Detailed implementation manners
[0047] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of them. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0048] In the prior art, when editing a disk, only a single disk technology can be operated each time. In some scenarios where it is necessary to add, delete, and edit the disk simultaneously, the user's operation will be relatively cumbersome. In this application, it is possible to support simultaneous operations of complex disk editing operations, support operations such as adding, deleting, and editing attributes simultaneously, and can also accurately allocate disk addresses and disk drive letters for the disk, improving the efficiency of disk editing.
[0049] An embodiment of the present invention discloses a disk processing method, as shown in Figure 1 It includes:
[0050] Step S11: Obtain a disk editing instruction, and determine a target disk list based on the disk editing instruction.
[0051] In this embodiment, after determining the target disk list based on the disk editing instruction, it may further include: integrating the target disk list with the original disk list and storing it in a preset container (i.e., List).
[0052] In this embodiment, after the user edits the disk, a disk editing instruction will be sent to the virtualization platform. After obtaining the disk editing instruction, the virtualization platform will determine a target disk list based on the disk editing instruction. In this embodiment, the target disk list is a new list generated after the user's editing.
[0053] Step S12: Compare the target disk list with the original disk list to add corresponding disk operation attributes to all disks in the target disk list and the original disk list based on the comparison result; the disk operation attributes are unchanged attribute, changed attribute, added attribute, and deleted attribute.
[0054] In this embodiment, the original disk list is the disk list before the user's editing. By comparing the target disk list with the original disk list, the specific editing process of the user on the disk can be determined.
[0055] In this embodiment, the comparing the target disk list with the original disk list to add corresponding disk operation attributes to all disks in the target disk list and the original disk list based on the comparison result may include: determining the disks with the same disk capacity, disk format, and disk attributes in the target disk list and the original disk list as the first target disks, and adding the disk operation attribute of unchanged attribute to the first target disks; determining the disks with the same disk capacity and disk format but different disk attributes in the target disk list and the original disk list as the second target disks, and adding the disk operation attribute of changed attribute to the first target disks; determining the disks included in the target disk list but not included in the original disk list as the third target disks, and adding the disk operation attribute of added attribute to the third target disks; determining the disks included in the original disk list but not included in the target disk list as the fourth target disks, and adding the disk operation attribute of deleted attribute to the fourth target disks.
[0056] That is, in this embodiment, disk setting operation attributes will be set for each disk according to the user's disk editing to identify what specific operations are performed on each disk. Preferably, the disk operation attributes of unchanged attribute, changed attribute, added attribute, and deleted attribute can be represented by UNCHANGE, CHANGE, ADD, and REMOVE respectively.
[0057] In the specific implementation process, the target disk list can be denoted as the currentDisk list, and the original disk list can be denoted as the originalDisk list. When a certain currentDisk in the currentDisk list is the same as a certain originalDisk in the originalDisk list, it is necessary to determine whether the attributes of the two disks are the same. If the attributes of the two disks are also the same, the disk operation attribute of UNCHANGE is added to the two disks; if the attributes of the two disks are different, the disk operation attribute of CHANGE is added to the two disks. In a specific implementation manner, it is possible to determine whether two disks are the same by determining whether the disk capacities and disk formats are the same.
[0058] In a specific implementation manner, when a certain currentDisk in the currentDisk list is not included in the originalDisk list, it indicates that this disk is a newly added disk, and the ADD attribute is added to this disk. When a certain originalDisk in the originalDisk list is not included in the currentDisk list, it indicates that this disk is a deleted disk, and the REMOVE attribute is added to this disk.
[0059] Step S13: Allocate disk addresses and disk drive letters for all the disks based on the respective disk operation attributes of all the disks.
[0060] In this embodiment, after the attributes are added, disk addresses and disk drive letters are allocated for each disk based on the attributes of each disk.
[0061] Step S14: Perform corresponding disk processing operations on all the disks based on the respective disk operation attributes of all the disks.
[0062] In this embodiment, after disk addresses and disk drive letters are allocated for each disk based on the attributes of each disk, corresponding disk processing operations are performed on all the disks based on the respective disk operation attributes of all the disks. In a specific implementation manner, the disks with the disk operation attribute of UNCHANGE are not processed, the disks with the disk operation attribute of CHANGE have their disk information modified, the disks with the disk operation attribute of ADD are created, and the disks with the disk operation attribute of REMOVE are deleted.
[0063] In this embodiment, first obtain a disk editing instruction, and determine a target disk list based on the disk editing instruction; compare the target disk list with the original disk list to add corresponding disk operation attributes to all disks in the target disk list and the original disk list based on the comparison result; the disk operation attributes are unchanged attribute, changed attribute, added attribute, and deleted attribute; allocate disk addresses and disk drive letters to all disks based on the disk operation attributes corresponding to each of the all disks; perform corresponding disk processing operations on all disks based on the disk operation attributes corresponding to each of the all disks. In this way, this application accepts the user's disk editing instruction, compares the target disk list determined based on the disk editing instruction with the original disk list, adds disk operation attributes to all disks based on the comparison result, then allocates disk addresses and disk drive letters to the disks, and then processes the disks based on the disk operation attributes. The present invention can support the user to perform operations such as adding, deleting, and editing disks simultaneously by automatically setting four disk operation attributes for the disks, and the present invention can automatically complete the processes of disk address allocation and disk drive letter allocation when the user performs complex disk operations, facilitating the user's operation and improving the disk editing efficiency.
[0064] Figure 2 It is a flowchart of a specific disk processing method provided by an embodiment of this application. Refer to Figure 2 As shown, the method includes:
[0065] Step S21: Obtain a disk editing instruction, and determine a target disk list based on the disk editing instruction.
[0066] Among them, for a more specific processing process of step S21, reference can be made to the corresponding content disclosed in the foregoing embodiment, and details will not be elaborated here.
[0067] Step S22: Compare the target disk list with the original disk list to add corresponding disk operation attributes to all disks in the target disk list and the original disk list based on the comparison result; the disk operation attributes are unchanged attribute, changed attribute, added attribute, and deleted attribute.
[0068] Among them, for a more specific processing process of step S22, reference can be made to the corresponding content disclosed in the foregoing embodiment, and details will not be elaborated here.
[0069] Step S23: Based on the disk operation attributes corresponding to each of the all disks, and using the disk addresses in the preset disk address constant pool, allocate disk addresses to all disks.
[0070] In a preferred implementation manner of this embodiment, in the process of allocating disk addresses for all the disks based on the disk operation attributes corresponding to each of the all disks and using the disk addresses in a preset disk address constant pool, the following steps may be included: deleting the disk addresses corresponding to the disks with disk operation attributes of change attribute and unchanged attribute from the preset disk address constant pool; and allocating disk addresses for the disks with disk operation attribute of new attribute by using the disk addresses saved in the preset disk address constant pool.
[0071] In this step, the disks with disk operation attributes of CHANGE and UNCHANGE still retain their corresponding disk addresses, and the disk addresses corresponding to these disks will not be modified in this step, so there is no need to allocate addresses for them. Moreover, when the user edits the disks, if there are disks with disk operation attribute of REMOVE, it indicates that these disks will be deleted, so there is no need to allocate addresses for these disks either. Therefore, in this step, the key is to allocate disk addresses only for the disks with disk operation attribute of ADD.
[0072] Specifically, in the process of disk allocation, some available disk addresses are defined in the preset disk address constant pool proposed in this step. Since the disks with disk operation attributes of CHANGE and UNCHANGE already have their disk addresses, the same disk addresses will not be used when allocating addresses for the disks later. Therefore, in this embodiment, the addresses already used by the disks with disk operation attributes of CHANGE and UNCHANGE will be deleted from the preset disk address constant pool first to ensure that reasonable disk addresses can be allocated for the disks with disk operation attribute of ADD by using the disk addresses saved in the preset disk address constant pool. In the specific implementation process, all the disk addresses allAddress can be obtained from the preset disk address constant pool first, and then the already used addresses, that is, the addresses already used by the disks with disk operation attributes of CHANGE and UNCHANGE, are removed from allAddress, and then addresses are allocated for all the disks with disk operation attribute of ADD.
[0073] Step S24: Allocate disk drive letters for all the disks based on the disk operation attributes corresponding to each of the all disks and using the disk drive letters in a preset disk drive letter constant pool.
[0074] In this embodiment, allocating disk drive letters to all the disks based on the disk operation attributes corresponding to each of the all disks and using the disk drive letters in a preset disk drive letter constant pool may include: determining a first drive letter from the preset disk drive letter constant pool, and traversing the disks in the target disk list to determine the boot disk in the target disk list, and then allocating the first drive letter to the boot disk; removing the disk drive letters corresponding to the disks with the disk operation attributes of unchanged attribute and changed attribute from the preset disk drive letter constant pool, and adding the disk drive letters corresponding to the disks with the disk operation attribute of deleted attribute to the preset disk drive letter constant pool; and allocating disk drive letters to the disks with the disk operation attribute of added attribute by using the disk drive letters saved in the preset disk drive letter constant pool.
[0075] In this embodiment, the preset disk drive letter constant pool is a constant pool with a limited total amount, in which some available disk drive letters are defined.
[0076] In this embodiment, a first drive letter may be determined from the preset disk drive letter constant pool first. The first drive letter is a dedicated drive letter for the boot disk. Then, all the disks are traversed to determine the boot disk from the disks and allocate the first drive letter to it. In a preferred embodiment, the dedicated drive letter for the boot disk may be set as drive letter **A.
[0077] In this embodiment, since the disk drive letters availableLabels in the preset disk drive letter constant pool are all available addresses, and the disk drive letters corresponding to the disks with the disk operation attributes of CHANGE and UNCHANGE have been used, the disk drive letters corresponding to the disks with the disk operation attributes of CHANGE and UNCHANGE will be deleted from the preset disk drive letter constant pool in this step. And since the disks with the disk operation attribute of REMOVE will be deleted, the disk drive letters of the disks with the disk operation attribute of REMOVE will also be recycled in this step, that is, the disk drive letters corresponding to the disks with the disk operation attribute of REMOVE are added to the preset disk drive letter constant pool. In this way, it can be ensured that reasonable disk drive letters are allocated to the disks with the disk operation attribute of ADD by using the disk drive letters saved in the preset disk drive letter constant pool.
[0078] Step S25: Perform corresponding disk processing operations on all the disks based on the disk operation attributes corresponding to each of the all disks.
[0079] In this embodiment, performing corresponding disk processing operations on all disks based on the disk operation attributes corresponding to each of the disks may include: using the preset operation interface to modify the information of the disk whose disk operation attribute is the change attribute, and saving the modified information to the preset database; using the preset operation interface to delete the disk whose disk operation attribute is the deletion attribute, and releasing the disk lock corresponding to the disk whose disk operation attribute is the deletion attribute, deleting the disk data and volume data of the corresponding disk in the preset database, and releasing the correspondence between the disk data and the volume data; using the preset operation interface to create a disk whose disk operation attribute is the add attribute, and recording the disk data and volume data for the created disk in the preset database, saving the correspondence between the disk data and the volume data, and then mounting the created disk to the current virtual machine.
[0080] It can be understood that since the disk whose disk operation attribute is UNCHANGE has not changed, no processing will be performed on it in this embodiment; the disk whose disk operation attribute is CHANGE only has attribute information modification, so in the specific processing process, it is only necessary to use the preset operation interface to modify the disk information; the disk whose disk operation attribute is REMOVE needs to be deleted, and in the specific processing process, it is necessary to send a disk deletion instruction to the preset operation interface, and synchronously execute the disk lock release operation, and then delete the disk data (disk) and volume data (volume) of the corresponding disk in the preset database (i.e., DB, data base); the disk whose disk operation attribute is ADD needs to be added, and in the specific processing process, it is necessary to call the preset operation interface to generate the disk, and save the corresponding disk data and volume data in the DB after success. After the disk is created, since the underlying operation interface will not mount the created disk to the current virtual machine, but the upper layer is saved in the DB, which will cause the upper layer DB of the virtual machine to be inconsistent with the underlying operation interface, it is necessary to mount the created disk to the current virtual machine to finally complete the addition of the virtual machine disk.
[0081] In this embodiment, the preset operation interface may be an API (ie, Application Programming Interface) provided by an underlying operation platform, and in a specific implementation manner may be an IVA interface.
[0082] In this embodiment, by obtaining a disk editing instruction and determining a target disk list based on the disk editing instruction; comparing the target disk list with the original disk list to add corresponding disk operation attributes to all disks in the target disk list and the original disk list based on the comparison result; the disk operation attributes are unchanged attribute, changed attribute, added attribute, and deleted attribute; based on the disk operation attributes corresponding to all disks respectively, and using the disk addresses in the preset disk address constant pool, disk addresses are assigned to all disks; based on the disk operation attributes corresponding to all disks respectively, and using the disk drive letters in the preset disk drive letter constant pool, disk drive letters are assigned to all disks; based on the disk operation attributes corresponding to all disks respectively, corresponding disk processing operations are performed on all disks. When a user performs complex disk operations, the allocation of disk addresses and disk drive letters can be automatically realized. In this embodiment, it is also proposed to use the preset operation interface at the bottom layer to complete the processing of disks, and update the information in the upper-layer DB, and finally achieve the consistency of disk information between the bottom layer and the upper layer, ensuring the accurate change of the number and attributes of disks in the platform and the bottom layer.
[0083] See Figure 3 As shown, an embodiment of the present application discloses a disk processing device, which may specifically include:
[0084] A target disk list determination module 11, configured to obtain a disk editing instruction and determine a target disk list based on the disk editing instruction;
[0085] A disk operation attribute adding module 12, configured to compare the target disk list with the original disk list to add corresponding disk operation attributes to all disks in the target disk list and the original disk list based on the comparison result; the disk operation attributes are unchanged attribute, changed attribute, added attribute, and deleted attribute;
[0086] A disk address and disk drive letter allocation module 13, configured to allocate disk addresses and disk drive letters to all disks based on the disk operation attributes corresponding to all disks respectively;
[0087] A disk processing module 14, configured to perform corresponding disk processing operations on all disks based on the disk operation attributes corresponding to all disks respectively.
[0088] In this application, first obtain a disk editing instruction, and determine a target disk list based on the disk editing instruction; compare the target disk list with the original disk list to add corresponding disk operation attributes to all the disks in the target disk list and the original disk list based on the comparison result; the disk operation attributes are unchanged attribute, changed attribute, added attribute, and deleted attribute; allocate disk addresses and disk drive letters to all the disks based on the disk operation attributes corresponding to each of the all disks; perform corresponding disk processing operations on all the disks based on the disk operation attributes corresponding to each of the all disks. In this way, this application accepts the user's disk editing instruction, compares the target disk list determined based on the disk editing instruction with the original disk list, adds disk operation attributes to all the disks based on the comparison result, then allocates disk addresses and disk drive letters to the disks, and then processes the disks based on the disk operation attributes. The present invention can support the user to perform operations such as adding, deleting, and editing disks simultaneously by automatically setting four disk operation attributes for the disks, and the present invention can automatically complete the process of disk address allocation and disk drive letter allocation when the user performs complex disk operations, which facilitates the user's operation and improves the disk editing efficiency.
[0089] In some specific embodiments, in the disk processing device, it further includes:
[0090] A disk list integration module, configured to integrate the target disk list and the original disk list and store them in a preset container.
[0091] In some specific embodiments, the disk operation attribute adding module 12 includes:
[0092] A first disk operation attribute adding unit, configured to determine the disks with the same disk capacity, disk format, and disk attributes in the target disk list and the original disk list as the first target disks, and add the disk operation attribute of the unchanged attribute to the first target disks;
[0093] A second disk operation attribute adding unit, configured to determine the disks with the same disk capacity and disk format but different disk attributes in the target disk list and the original disk list as the second target disks, and add the disk operation attribute of the changed attribute to the first target disks;
[0094] A third disk operation attribute adding unit, configured to determine the disks included in the target disk list but not included in the original disk list as the third target disks, and add the disk operation attribute of the added attribute to the third target disks;
[0095] A fourth disk operation attribute adding unit, configured to determine a disk that is included in the original disk list but not included in the target disk list as a fourth target disk, and add a disk operation attribute of a deletion attribute to the fourth target disk.
[0096] In some specific embodiments, the disk address and disk drive letter allocation module 13 includes:
[0097] A disk address allocation unit, configured to allocate disk addresses to all the disks based on the disk operation attributes respectively corresponding to all the disks and by using the disk addresses in a preset disk address constant pool;
[0098] A disk drive letter allocation unit, configured to allocate disk drive letters to all the disks based on the disk operation attributes respectively corresponding to all the disks and by using the disk drive letters in a preset disk drive letter constant pool.
[0099] In some specific embodiments, the disk address allocation unit includes:
[0100] A disk address deletion unit, configured to delete the disk addresses corresponding to the disks with disk operation attributes of change attribute and unchanged attribute from the preset disk address constant pool;
[0101] A new attribute disk address allocation unit, configured to allocate disk addresses to the disks with disk operation attribute of new attribute by using the disk addresses saved in the preset disk address constant pool.
[0102] In some specific embodiments, the disk drive letter allocation unit includes:
[0103] A boot disk drive letter allocation unit, configured to determine a first drive letter from the preset disk drive letter constant pool, traverse the disks in the target disk list to determine the boot disk in the target disk list, and then allocate the first drive letter to the boot disk;
[0104] A disk drive letter deletion and recycling unit, configured to remove the disk drive letters corresponding to the disks with disk operation attributes of unchanged attribute and change attribute from the preset disk drive letter constant pool, and add the disk drive letters corresponding to the disks with disk operation attribute of deletion attribute to the preset disk drive letter constant pool;
[0105] A new attribute disk drive letter allocation unit, configured to allocate disk drive letters to the disks with disk operation attribute of increase attribute by using the disk drive letters saved in the preset disk drive letter constant pool.
[0106] In some specific embodiments, the disk processing module 14 includes:
[0107] A first disk processing unit, configured to modify information of the disk whose disk operation attribute is a change attribute by using the preset operation interface, and save the modified information into a preset database;
[0108] The second disk processing unit is used to delete the disk whose disk operation attribute is the deletion attribute by using the preset operation interface, release the disk lock corresponding to the disk whose disk operation attribute is the deletion attribute, delete the disk data and volume data of the corresponding disk in the preset database, and cancel the correspondence between the disk data and the volume data;
[0109] The third disk processing unit is used to use the preset operation interface to create a disk with the disk operation attribute of adding attributes, and record the disk data and volume data for the created disk in the preset database, save the correspondence between the disk data and the volume data, and then mount the created disk to the current virtual machine.
[0110] Furthermore, the present application also discloses an electronic device. Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment, and the content in the diagram cannot be considered as any limitation on the scope of use of the present application.
[0111] Figure 4 The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a display screen 24, an input / output interface 25, a communication interface 26, and a communication bus 27. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the disk processing method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0112] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 26 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0113] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222 and virtual machine data 223, etc. The virtual machine data 223 may include various data. The storage method may be temporary storage or permanent storage.
[0114] Among them, the operating system 221 is used to manage and control each hardware device and the computer program 222 on the electronic device 20, and it can be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program that can be used to complete the disk processing method executed by the electronic device 20 disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs that can be used to complete other specific tasks.
[0115] Furthermore, the present application also discloses a computer-readable storage medium. The computer-readable storage medium mentioned here includes random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, magnetic disks, or optical disks, or any other form of storage medium known in the technical field. Among them, when the computer program is executed by a processor, it implements the disk processing method disclosed above. For the specific steps of this method, reference can be made to the corresponding content disclosed in the foregoing embodiments, and details will not be repeated here.
[0116] In this specification, the various embodiments are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts between the various embodiments, reference can be made to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and reference can be made to the description in the method part for the relevant parts. Professionals can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0117] The steps of the method or algorithm described in combination with the embodiments disclosed in this article can be directly implemented by hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the technical field.
[0118] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising said element.
[0119] The above has introduced in detail the disk processing method, device, equipment, and storage medium provided by the present invention. Specific examples are used in this text to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present invention.
Claims
1. A disk processing method, characterized in that, Including: Obtain a disk editing instruction and determine a target disk list based on the disk editing instruction; The target disk list is a new edited list generated after user editing; Compare the target disk list with the original disk list to add corresponding disk operation attributes to all disks in the target disk list and the original disk list based on the comparison result; The disk operation attributes are unchanged attribute, changed attribute, added attribute, and deleted attribute; the original disk list is the disk list before user editing; Allocate disk addresses and disk drive letters to all disks based on the disk operation attributes corresponding to each of the all disks; Perform corresponding disk processing operations on all disks based on the disk operation attributes corresponding to each of the all disks.
2. The disk processing method according to claim 1, characterized in that After determining the target disk list based on the disk editing instruction, it further includes: Integrate the target disk list and the original disk list and store them in a preset container.
3. The disk processing method according to claim 1, characterized in that The comparing the target disk list with the original disk list to add corresponding disk operation attributes to all disks in the target disk list and the original disk list based on the comparison result includes: Determine disks with the same disk capacity, disk format, and disk attributes in the target disk list and the original disk list as the first target disks, and add the disk operation attribute of unchanged attribute to the first target disks; Determine disks with the same disk capacity and disk format but different disk attributes in the target disk list and the original disk list as the second target disks, and add the disk operation attribute of changed attribute to the second target disks; Determine disks included in the target disk list but not included in the original disk list as the third target disks, and add the disk operation attribute of added attribute to the third target disks; Determine disks included in the original disk list but not included in the target disk list as the fourth target disks, and add the disk operation attribute of deleted attribute to the fourth target disks.
4. The disk processing method according to claim 1, characterized in that The allocating disk addresses and disk drive letters to all disks based on the disk operation attributes corresponding to each of the all disks includes: Allocate disk addresses to all disks based on the disk operation attributes corresponding to each of the all disks and using the disk addresses in a preset disk address constant pool; Allocate disk drive letters to all disks based on the disk operation attributes corresponding to each of the all disks and using the disk drive letters in a preset disk drive letter constant pool.
5. The disk processing method according to claim 4, characterized in that, In the process of allocating disk addresses to all disks based on the disk operation attributes corresponding to each of the all disks and using the disk addresses in a preset disk address constant pool, it includes: Delete the disk addresses corresponding to the disks with the disk operation attributes of changed attribute and unchanged attribute from the preset disk address constant pool; Allocate disk addresses to the disks with the disk operation attribute of new added attribute using the disk addresses saved in the preset disk address constant pool.
6. The disk processing method according to claim 4, wherein The allocating disk drive letters to all disks based on the disk operation attributes corresponding to all disks and using disk drive letters in a preset disk drive letter constant pool includes: Determine a first drive letter from a preset disk drive letter constant pool, traverse the disks in the target disk list to determine a boot disk in the target disk list, and then assign the first drive letter to the boot disk; Remove the disk drive letters corresponding to the disks whose disk operation attributes are unchanged and changed from the preset disk drive letter constant pool, and add the disk drive letters corresponding to the disks whose disk operation attributes are deleted to the preset disk drive letter constant pool; A disk drive letter stored in a preset disk drive letter constant pool is used to assign a disk drive letter to a disk whose disk operation attribute is to add an attribute.
7. The disk processing method according to any one of claims 1 to 6, characterized in that The performing corresponding disk processing operations on all the disks based on the disk operation attributes corresponding to all the disks respectively includes: Using a preset operation interface, modifying information of the disk whose disk operation attribute is to change the attribute, and saving the modified information into a preset database; Deleting the disk whose disk operation attribute is the deletion attribute by using the preset operation interface, releasing the disk lock corresponding to the disk whose disk operation attribute is the deletion attribute, deleting the disk data and volume data of the corresponding disk in the preset database, and canceling the corresponding relationship between the disk data and the volume data; The disk with the disk operation attribute of adding attributes is created by using the preset operation interface, and the disk data and volume data are recorded for the created disk in the preset database, and the corresponding relationship between the disk data and the volume data is saved, and then the created disk is mounted to the current virtual machine.
8. A disk processing device, characterized in that, include: A target disk list determination module, used for obtaining a disk editing instruction and determining a target disk list based on the disk editing instruction; The target disk list is a new list generated after editing by the user; A disk operation attribute adding module, used for comparing the target disk list with the original disk list, so as to add corresponding disk operation attributes to all disks in the target disk list and the original disk list based on the comparison result; The disk operation attributes include unchanged attributes, changed attributes, added attributes, and deleted attributes; the original disk list is the disk list before the user edits it; A disk address and disk letter allocation module, used for allocating disk addresses and disk letters to all disks based on the disk operation attributes corresponding to all disks; The disk processing module is used to perform corresponding disk processing operations on all the disks based on the disk operation attributes corresponding to all the disks.
9. An electronic device, characterized in that, It comprises a processor and a memory; wherein, when the processor executes the computer program stored in the memory, the disk processing method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that, Used to store computer programs; wherein, when the computer program is executed by a processor, the disk processing method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method for realizing secure network backup system under cloud storage environment
CN102685148A
Hyper-V virtual machine backup and restoration method
CN114138563A