CN107577426B - Virtual disk management method and device - Google Patents

Virtual disk management method and device Download PDF

Info

Publication number
CN107577426B
CN107577426B CN201710766056.1A CN201710766056A CN107577426B CN 107577426 B CN107577426 B CN 107577426B CN 201710766056 A CN201710766056 A CN 201710766056A CN 107577426 B CN107577426 B CN 107577426B
Authority
CN
China
Prior art keywords
virtual disk
virtual
list
calling
interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710766056.1A
Other languages
Chinese (zh)
Other versions
CN107577426A (en
Inventor
栗丽霞
闫冬冬
张百林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201710766056.1A priority Critical patent/CN107577426B/en
Publication of CN107577426A publication Critical patent/CN107577426A/en
Application granted granted Critical
Publication of CN107577426B publication Critical patent/CN107577426B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a virtual disk management method, which comprises the following steps: receiving an operation instruction aiming at the virtual disk sent by a user through a graphical interface, determining operation information according to the operation instruction, wherein the operation information at least comprises an operation type and a mapping object to which the virtual disk belongs, determining service processing logic according to the operation information, and performing corresponding operation on the virtual disk based on the service processing logic. By applying the technical scheme provided by the embodiment of the invention, the operation instruction sent by the user through the graphical interface is received, and then the corresponding operation on the virtual disk can be realized according to the operation instruction, so that the user can conveniently manage the virtual disk, and the virtual disk management efficiency is improved. The invention also discloses a virtual disk management device, which has corresponding technical effects.

Description

Virtual disk management method and device
Technical Field
The present invention relates to the field of virtualization technologies, and in particular, to a virtual disk management method and apparatus.
Background
With the progress of scientific technology, virtualization technology gradually comes into the sight of people, wherein the more common virtualization technology is server virtualization.
Server virtualization includes storage virtualization, network virtualization, memory virtualization, CPU virtualization, etc., where storage virtualization provides a storage basis for server virtualization. One of the key items in storage virtualization is virtual disk management.
At present, the most common virtual disk management mode is to use a virtual disk as a component of a physical storage or a virtual machine, which is not listed separately, and even no large and full function set for virtual disk management needs a user to manage the virtual disk in a manner of beating commands in a Linux environment.
In summary, how to effectively improve the efficiency of virtual disk management is a technical problem that needs to be solved by those skilled in the art.
Disclosure of Invention
The invention aims to provide a virtual disk management method and a virtual disk management device so as to improve the virtual disk management efficiency.
In order to solve the technical problems, the invention provides the following technical scheme:
a virtual disk management method comprises the following steps:
receiving an operation instruction aiming at the virtual disk, which is sent by a user through a graphical interface;
determining operation information according to the operation instruction, wherein the operation information at least comprises an operation type and a mapping object to which the virtual disk belongs;
determining a service processing logic according to the operation information;
and performing corresponding operation on the virtual disk based on the service processing logic.
Preferably, the determining a service processing logic according to the operation information includes:
when the operation information is that virtual disk list viewing operation is performed on a virtual disk in a repository, the determined service processing logic is as follows:
determining a first repository of a virtual disk list to be viewed by calling a XenAPI interface according to the repository identification code;
acquiring a virtual disk list of the first repository by calling the XenAPI interface;
packaging the virtual disk list of the first repository and returning the virtual disk list to the graphical interface;
alternatively, the first and second electrodes may be,
when the operation information is that virtual disk list viewing operation is performed on a virtual disk under a virtual machine, the determined service processing logic is as follows:
according to the virtual machine identification code, a first virtual machine of a virtual disk list to be viewed is determined by calling a XenAPI interface;
acquiring a virtual disk list of the first virtual machine by calling the XenAPI;
if the first virtual machine has virtual block equipment to be processed, acquiring virtual disk information corresponding to the virtual block equipment to be processed, and adding the virtual disk information to a virtual disk list of the first virtual machine;
and packaging the virtual disk list of the first virtual machine and returning the packaged virtual disk list to the graphical interface.
Preferably, the determining a service processing logic according to the operation information includes:
when the operation information is the virtual disk adding operation performed under the repository, the determined service processing logic is as follows:
acquiring a current selectable first storage library list by calling a XenAPI interface;
receiving and analyzing a first adding parameter of the user, and determining a second repository to which a virtual disk is to be added in the first repository list;
and creating a first virtual disk in the second storage library by calling the XenAPI interface.
Preferably, the determining a service processing logic according to the operation information includes:
when the operation information is that virtual disk adding operation is performed under the virtual machine, the determined service processing logic is as follows:
acquiring a current optional second storage library list by calling a XenAPI interface;
receiving and analyzing a second adding parameter of the user, and determining a third repository to which the virtual disk is to be added in the second repository list;
creating a second virtual disk by calling the XenAPI interface;
receiving and analyzing the configuration information of the user for the second virtual disk, and packaging the configuration information into first virtual block equipment;
and adding the first virtual block device by calling the XenAPI interface.
Preferably, the determining a service processing logic according to the operation information includes:
when the operation information is that virtual disk connection operation is performed under a virtual machine, the determined service processing logic is as follows:
obtaining an optional virtual disk list by calling a XenAPI interface;
receiving and analyzing the connection parameters of the user, and packaging the connection parameters into second virtual block equipment;
adding the second virtual block device by calling the XenAPI interface;
and when the addition of the second virtual block equipment fails and the second virtual block equipment allows plug operation, the plug operation is carried out by calling the XenAPI.
Preferably, the service processing logic determined according to the operation information includes:
when the operation information is that virtual disk separation operation is performed under a virtual machine, the determined service processing logic is as follows:
determining whether a virtual machine connected with each virtual block device to be processed is a second virtual machine to be subjected to virtual disk separation or not and whether the virtual block device allows unprug operation or not, and if so, calling a XenAPI interface to perform unprug operation;
and carrying out destruction operation by calling the XenAPI interface.
Preferably, the determining a service processing logic according to the operation information includes:
when the operation information is the virtual disk moving operation under the repository or the virtual machine, the determined service processing logic is as follows:
determining a third virtual disk to be moved and a third storage library to which the virtual disk can be moved;
copying the third virtual disk into a fourth virtual disk by calling a XenAPI (application program interface), and moving the fourth virtual disk to the third repository;
judging whether the type of the fourth virtual disk is a suspend type;
if so, and the suspend-type virtual disk in each traversed virtual machine is the third virtual disk, setting the third virtual disk as the fourth virtual disk;
and destroying the third virtual disk by calling the XenAPI interface.
Preferably, the determining a service processing logic according to the operation information includes:
when the operation information is the virtual disk modification operation under the storage library or the virtual machine, the determined service processing logic is as follows:
determining a fifth virtual disk to be modified by calling a XenAPI interface according to the virtual disk identification code;
and for each attribute which is contained in the parameter list and allowed to be modified, when the attribute value of the attribute is determined to be different from the attribute value of the fifth virtual disk, the modified attribute is saved in a database by calling the XenAPI interface.
Preferably, the determining a service processing logic according to the operation information includes:
when the operation information is that virtual disk deletion operation is performed under a storage library or a virtual machine, the determined service processing logic is as follows:
determining a sixth virtual disk to be deleted by calling a XenAPI interface according to the virtual disk identification code;
acquiring a virtual block device list corresponding to the sixth virtual disk by calling the XenAPI;
newly building an empty virtual machine snapshot list to be deleted;
for each virtual block device in the virtual block device list, acquiring corresponding virtual machine information by calling the XenAPI;
if the virtual machine information is not null, calling a virtual disk separation interface to separate the virtual disk from the virtual machine;
if the virtual machine is not a snapshot or the virtual machine information is not in the to-be-deleted virtual machine snapshot list, adding the snapshot information of the virtual machine into the to-be-deleted virtual machine snapshot list;
destroying the sixth virtual machine disk by calling the XenAPI interface;
and if the virtual machine snapshot list to be deleted is not empty, calling a snapshot deletion interface to delete all snapshots in the virtual machine snapshot list to be deleted.
A virtual disk management apparatus, comprising:
the operation instruction receiving module is used for receiving an operation instruction which is sent by a user through a graphical interface and aims at the virtual disk;
an operation information determining module, configured to determine operation information according to the operation instruction, where the operation information at least includes an operation type and a mapping object to which the virtual disk belongs;
the service processing logic determining module is used for determining service processing logic according to the operation information;
and the operation processing module is used for carrying out corresponding operation on the virtual disk based on the service processing logic.
By applying the technical scheme provided by the embodiment of the invention, the operation instruction aiming at the virtual disk and sent by a user through the graphical interface is received, the operation information is determined according to the operation instruction, the operation information at least comprises the operation type and the mapping object to which the virtual disk belongs, the service processing logic is determined according to the operation information, and the corresponding operation is carried out on the virtual disk based on the service processing logic. And receiving an operation instruction sent by a user through a graphical interface, and then performing corresponding operation on the virtual disk according to the operation instruction, so that the user can manage the virtual disk conveniently, and the virtual disk management efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of an implementation of a virtual disk management method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a first service processing logic of a virtual disk management method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a second service processing logic of the virtual disk management method according to the embodiment of the present invention;
fig. 4 is a schematic diagram of a third service processing logic of the virtual disk management method in the embodiment of the present invention;
fig. 5 is a schematic diagram of a fourth service processing logic of the virtual disk management method in the embodiment of the present invention;
fig. 6 is a schematic diagram of a fifth service processing logic of the virtual disk management method in the embodiment of the present invention;
fig. 7 is a schematic diagram of a sixth service processing logic of the virtual disk management method in the embodiment of the present invention;
fig. 8 is a schematic diagram of a seventh service processing logic of the virtual disk management method in the embodiment of the present invention;
fig. 9 is a schematic diagram of an eighth service processing logic of the virtual disk management method in the embodiment of the present invention;
fig. 10 is a schematic diagram of a ninth service processing logic of the virtual disk management method in the embodiment of the present invention;
fig. 11 is a schematic structural diagram of a virtual disk management apparatus according to an embodiment of the present invention.
Detailed Description
The core of the invention is to provide a virtual disk management method, when receiving an operation instruction aiming at a virtual disk sent by a user through a graphical interface, determining operation information according to the operation instruction, wherein the operation information at least comprises an operation type and a mapping object to which the virtual disk belongs, determining service processing logic according to the operation information, and performing corresponding operation on the virtual disk based on the service processing logic. And receiving an operation instruction sent by a user through a graphical interface, and then performing corresponding operation on the virtual disk according to the operation instruction, so that the user can conveniently manage the virtual disk, and the virtual disk management efficiency is improved.
In practical Application, firstly, development of a service logic part can be completed through a Java high-level language and a Spring + SpringMVC framework, and the service logic part is packaged into a Representational State Transfer (REST) API (Application Programming Interface) which is strong in readability and easy to expand, so that virtual disk management is realized, and a REST API calling Interface is provided for a graphical Interface to support graphical Interface calling.
The REST API for the virtual disk management method provided by the present invention can be implemented as follows: operations of adding, deleting, modifying, viewing and the like of a Virtual Disk (VD) under a Storage Repository (SR); operations of adding, connecting, migrating, deleting, separating, viewing, modifying and the like of the VD under a Virtual Machine (VM); modifying some other auxiliary interfaces, such as adding a VD, requires invoking an operation of querying the available SR list, etc.
Specifically, the mapping relationship among the VD, the VM, and the SR may be as follows: one SR corresponds to a plurality of VDs, and one VD must belong to a certain SR, namely a virtual disk must belong to a certain SR; one VM corresponds to a plurality of VDs, and one VD can be connected with the plurality of VMs, wherein the connection between the VM and the VD is realized by Virtual Block Devices (VBDs), specifically, the VBDs correspond to one VM and one VD respectively, for example, when a VM is connected with a VD, one VBD is established first, and then the VBDs and the VD are established respectively, and the corresponding relationship between the VBDs and the VM is established, so that the connection between the VM and the VD is realized; and the VM separates the VD and deletes the VBD.
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating an implementation of a virtual disk management method according to an embodiment of the present invention, including the following steps:
s101, receiving an operation instruction aiming at the virtual disk, which is sent by a user through a graphical interface.
In the embodiment of the present invention, a graphical interface may be preset, and specific details of the graphical interface, such as a width and a height of the interface, a size of a button, a specific tab, and a specific partition of the interface, may be set in advance, which is not limited in the embodiment of the present invention.
In the embodiment of the present invention, a REST a PI for virtual disk management may also be provided. The REST API may be invoked by the graphical interface provided by embodiments of the present invention.
In the graphical interface, the user can select the operation of the virtual disk by clicking a button or a tab, inputting characters or instructions in an input box, inputting voice and the like. After the user selects the operation for the virtual disk by clicking a button or a tab, inputting characters or instructions in an input box, inputting voice, and the like through the graphical interface, the REST API provided in the embodiment of the present invention may determine that the user has sent an operation instruction for the virtual disk through the graphical interface after detecting the operation.
For example, when a user clicks a view VD button on a graphical interface, the REST API may consider that an operation of clicking the view VD button by the user is equivalent to an operation instruction for the virtual disk sent by the user through the graphical interface.
After receiving the operation instruction, the operation of step S102 may be performed.
And S102, determining operation information according to the operation instruction.
The operation information at least comprises an operation type and a mapping object to which the virtual disk belongs.
In the embodiment of the present invention, an operation information base may be preset, where the operation information base stores a plurality of pieces of operation information, each piece of operation information at least includes an operation type and a mapping object to which each virtual disk belongs, and each piece of operation information corresponds to a specific operation instruction, that is, the operation information base also stores a corresponding relationship between the operation information and the operation instruction. It should be noted that the operation information in the operation information base may be preset or may be adjusted according to actual situations, which is not limited in the embodiment of the present invention.
According to an operation instruction sent by a user through a graphical interface, the operation information can be queried in an operation information base to determine operation information, where the determined operation information at least includes an operation type and a mapping object to which a virtual disk belongs, where the operation type includes operations such as viewing, adding, connecting, migrating, deleting, separating, and modifying a VD, and the mapping object to which the virtual disk belongs, that is, to which SR or VM the operated VD belongs, or an operation instruction sent by the user for the SR graphical interface or the VM graphical interface.
After the operation information is determined, the operation of step S103 may be performed.
S103, determining a service processing logic according to the operation information.
In this embodiment, a service processing logic library may be preset, where the service processing logic library stores a service processing logic corresponding to each operation information, and specifically, the service processing logic in the service processing logic library may be preset, or may be determined and adjusted according to an actual situation, which is not limited in this embodiment of the present invention.
The operation information determined in step S102 may be queried in a service processing logic library to determine a service processing logic corresponding to the operation information.
And S104, performing corresponding operation on the virtual disk based on the service processing logic.
Based on the service processing logic determined in step S103, corresponding operations of the service processing logic may be performed on the virtual disk. For example, if the determined service processing logic is to acquire a virtual disk list of the first virtual machine from the SR through the XenAPI interface and encapsulate the disk list to the graphical interface, then, based on the service processing logic, performing a corresponding operation on the virtual disk is to execute an operation of acquiring the virtual disk list of the first virtual machine from the SR through the XenAPI interface and encapsulating the disk list to the graphical interface, so that the user views the virtual disk list on the graphical interface.
By applying the method provided by the embodiment of the invention, the operation instruction aiming at the virtual disk and sent by a user through the graphical interface is received, the operation information is determined according to the operation instruction, the operation information at least comprises the operation type and the mapping object to which the virtual disk belongs, the service processing logic is determined according to the operation information, and the corresponding operation is carried out on the virtual disk based on the service processing logic. And receiving an operation instruction sent by a user through a graphical interface, and then performing corresponding operation on the virtual disk according to the operation instruction, so that the user can conveniently manage the virtual disk, and the virtual disk management efficiency is improved.
In order to facilitate understanding of the technical solutions of the present invention, the following takes specific operation information as an example to describe the embodiments of the present invention in detail.
In an embodiment of the present invention, after it is detected that a user clicks a view virtual disk tab on an SR graphical interface in the graphical interface, the user is considered to receive an operation instruction, and according to the operation instruction, it may be finally determined that operation information is a virtual disk list view operation for a virtual disk in a repository, and according to the operation information, specific contents of a service processing logic determined with reference to fig. 2 are referred to, where the service processing logic includes the following steps:
s201, according to the repository identification code, determining a first repository of the virtual disk list to be viewed by calling a XenAPI interface;
s202, acquiring a virtual disk list of a first repository by calling a XenAPI (application programming interface);
s203, packaging the virtual disk list of the first repository and returning the packaged virtual disk list to the graphical interface.
A repository can be identified by a repository Identifier (UUID), and the XenAPI is a Xen application program interface.
Through the service processing logic, virtual disk list viewing operation can be performed on the virtual disks in the storage library.
In an embodiment of the present invention, when it is detected that a user clicks a view virtual disk tab on a VM graphical interface in the graphical interface, that is, when an operation instruction is received, it may be finally determined that operation information is a virtual disk list view operation performed on a virtual disk in a virtual machine according to the operation instruction, and a specific content of a service processing logic determined according to the operation information refers to fig. 3, where the service processing logic includes the following steps:
s301, according to the virtual machine identification code, a first virtual machine of a virtual disk list to be viewed is determined by calling a XenAPI interface;
s302, acquiring a virtual disk list of a first virtual machine by calling a XenAPI (application program interface);
s303, if the first virtual machine has the virtual block device to be processed, acquiring the corresponding virtual disk information of the virtual block device to be processed, and adding the virtual disk information to a virtual disk list of the first virtual machine;
s304, packaging the virtual disk list of the first virtual machine and returning the packaged virtual disk list to the graphical interface.
In this embodiment, in step S303, specifically, it may be determined, for each virtual block device in the first virtual machine, whether the virtual block device is a to-be-processed virtual block device; if so, acquiring the corresponding virtual disk information of the to-be-processed virtual block device, and adding the corresponding virtual disk information to the virtual disk list of the first virtual machine until all the to-be-processed virtual block devices are processed.
Through the service processing logic, virtual disk list viewing operation can be performed on the virtual disk under the virtual machine.
In an embodiment of the present invention, when it is detected that a user clicks an add virtual disk tab on an SR graphical interface in the graphical interface, that is, when it is considered that an operation instruction is received, it may be finally determined that operation information is a virtual disk add operation performed in a repository according to the operation instruction, and referring to fig. 4, specific content of a service processing logic determined according to the operation information, the service processing logic includes the following steps:
s401, obtaining a current optional first repository list by calling a XenAPI interface;
s402, receiving and analyzing a first adding parameter of a user, and determining a second repository to which a virtual disk is to be added in a first repository list;
and S403, creating a first virtual disk in the second storage library by calling the XenAPI interface.
Through the service processing logic, the virtual disk adding operation can be realized under the storage library.
In an embodiment of the present invention, it is detected that a user clicks an add virtual disk tab on a VM graphical interface in the graphical interface, that is, it is considered that an operation instruction is received, it can be finally determined that the operation information is a virtual disk add operation performed in a virtual machine according to the operation instruction, and referring to fig. 5, specific contents of a service processing logic determined according to the operation information, the service processing logic includes the following steps:
s501, obtaining a current optional second repository list by calling a XenAPI interface;
s502, receiving and analyzing a second adding parameter of the user, and determining a third repository to which the virtual disk is to be added in a second repository list;
s503, creating a second virtual disk by calling a XenAPI interface;
s504, receiving and analyzing configuration information of a user for a second virtual disk, and packaging the configuration information into first virtual block equipment;
and S505, adding the first virtual block device by calling the XenAPI interface.
In this embodiment, the user may set the configuration information for the virtual disk by inserting a command, such as vmhit ═ { uuid }.
Through the service processing logic, the virtual disk adding operation can be realized under the virtual machine.
In an embodiment of the present invention, it is detected that a user clicks a virtual disk tab in a VM graphical interface in the graphical interface, that is, it is considered that an operation instruction is received, it can be finally determined that operation information is a virtual disk connection operation performed in a virtual machine according to the operation instruction, and referring to fig. 6, specific contents of a service processing logic determined according to the operation information, the service processing logic includes the following steps:
s601, obtaining a selectable virtual disk list by calling a XenAPI interface;
s602, receiving and analyzing the connection parameters of the user, and packaging the connection parameters into second virtual block equipment;
s603, adding a second virtual block device by calling a XenAPI interface;
s604, when the addition of the second virtual block device fails and the second virtual block device allows plug operation, the plug operation is performed by calling the XenAPI interface.
Through the service processing logic, the virtual disk connection operation can be realized under the virtual machine.
In the present embodiment, if the second virtual block device addition fails or the plug (insert) operation is not allowed, the connection operation is directly ended.
In an embodiment of the present invention, it is detected that a user clicks a separate virtual disk tab on a VM graphical interface in the graphical interface, that is, it is considered that an operation instruction is received, it can be finally determined that the operation information is a virtual disk separation operation performed in a virtual machine according to the operation instruction, and referring to fig. 7, specific contents of a service processing logic determined according to the operation information, the service processing logic includes the following steps:
s701, determining whether a virtual machine connected with each to-be-processed virtual block device is a second virtual machine to be subjected to virtual disk separation or not and whether the virtual block device allows unprug operation or not, and if so, calling a XenAPI interface to perform unprug operation;
and S702, carrying out destruction operation by calling a XenAPI interface.
In this embodiment, in step S701, specifically, for each to-be-processed virtual block device of the virtual disk, it may be determined whether a virtual machine connected to the virtual block device is a designated virtual machine, that is, a second virtual machine, and if yes, and the virtual block device allows an unprogrammed operation, the unprogrammed operation is performed by calling the XenAPI interface.
Through the service processing logic, the virtual disk separation operation can be realized under the virtual machine.
In an embodiment of the present invention, it is detected that a user selects a movable VD on an SR or VM graphical interface in the graphical interface, clicks a move sending instruction, selects a destination address, and then clicks a send instruction determining tab, that is, it is considered that an operation instruction is received, according to the operation instruction, it can be finally determined that operation information is for performing virtual disk moving operation under a repository or a virtual machine, and according to the operation information, specific contents of a determined service processing logic please refer to fig. 8, where the service processing logic includes the following steps:
s801, determining a third virtual disk to be moved and a third storage library to which the virtual disk can be moved;
s802, copying the third virtual disk into a fourth virtual disk by calling the XenAPI, and moving the fourth virtual disk to a third repository;
s803, judging whether the type of the fourth virtual disk is a suspend type, wherein the suspend type is a type which can suspend execution of the shell;
s804, if the first virtual disk is the second virtual disk, the suspend type virtual disk in each traversal virtual machine is the third virtual disk, and the third virtual disk is set as a fourth virtual disk;
and S805, destroying the third virtual disk by calling the XenAPI interface.
Specifically, in step S804, a Foreach statement may be used to cyclically access the suspend-type virtual disk in the virtual machine and set the suspend-type virtual disk as a third virtual disk, and set the third virtual disk as a fourth virtual disk.
Through the service processing logic, the virtual disk moving operation can be performed under a storage library or a virtual machine.
In an embodiment of the present invention, it is detected that a user clicks a modification virtual disk tab on an SR or VM graphical interface in a graphical interface, that is, it is considered that an operation instruction is received, according to the operation instruction, it may be finally determined that operation information is a virtual disk modification operation performed in a repository or a virtual machine, and according to the operation information, specific contents of a service processing logic determined with reference to fig. 9 are referred to, where the service processing logic includes the following steps:
s901, determining a fifth virtual disk to be modified by calling a XenAPI interface according to the virtual disk identification code;
and S902, aiming at each attribute which is contained in the parameter list and allowed to be modified, when the attribute value of the attribute is determined to be different from the attribute value of the fifth virtual disk, storing the modified attribute in a database by calling a XenAPI interface.
Specifically, in step S902, it may be sequentially determined whether the parameter list includes an attribute name, such as a key, that is allowed to be modified; if yes, further judging whether the attribute value in the parameter is the same as the attribute value of the fifth virtual disk; if the attribute is the same as the attribute, the attribute is modified, or the attribute does not need to be modified, and if the attribute is not the same as the attribute, the modified attribute is saved in a database by calling a XenAPI interface.
Through the service processing logic, the virtual disk modification operation can be performed under a storage library or a virtual machine.
In an embodiment of the present invention, it is detected that a user selects a deletable VD in an SR or VM graphical interface in the graphical interface and clicks a VD deletion option card, that is, it is considered that an operation instruction is received, it can be finally determined according to the operation instruction that the operation information is a virtual disk deletion operation performed under a repository or a virtual machine, and according to the operation instruction, the specific content of the service processing logic determined according to the operation information please refer to fig. 10, where the service processing logic includes the following steps:
s1001, according to the virtual disk identification code, determining a sixth virtual disk to be deleted by calling a XenAPI interface;
s1002, acquiring a virtual block device list corresponding to a sixth virtual disk by calling a XenAPI (application programming interface);
s1003, building an empty virtual machine snapshot list to be deleted;
s1004, aiming at each virtual block device in the virtual block device list, acquiring corresponding virtual machine information by calling a XenAPI (extensible application program interface);
s1005, if the virtual machine information is not null, calling a virtual disk separation interface to separate the virtual disk from the virtual machine;
s1006, if the virtual machine is not a snapshot or the virtual machine information is not in the to-be-deleted virtual machine snapshot list, adding the snapshot information of the virtual machine into the to-be-deleted virtual machine snapshot list;
s1007, destroying the sixth virtual machine disk by calling a XenAPI interface;
and S1008, if the virtual machine snapshot list to be deleted is not empty, calling a snapshot deletion interface to delete all snapshots in the virtual machine snapshot list to be deleted.
Through the service processing logic, the virtual disk deleting operation can be realized under the memory bank or the virtual machine.
In this embodiment, in step S1006, when the virtual machine is a snapshot or the virtual machine information is in the to-be-deleted virtual machine snapshot list, feedback may be performed so that, when the operation in step S1004 is executed, a corresponding operation is performed for the next virtual block device.
Corresponding to the above method embodiment, an embodiment of the present invention further provides a virtual disk management apparatus, and a virtual disk management apparatus described below and a virtual disk management method described above may be referred to in correspondence.
Referring to fig. 11, the apparatus includes the following modules:
an operation instruction receiving module 1101, configured to receive an operation instruction for the virtual disk, which is sent by a user through a graphical interface;
an operation information determining module 1102, configured to determine operation information according to the operation instruction, where the operation information at least includes an operation type and a mapping object to which the virtual disk belongs;
a service processing logic determining module 1103, configured to determine a service processing logic according to the operation information;
and the operation processing module 1104 is configured to perform corresponding operations on the virtual disk based on the service processing logic.
The device provided by the embodiment of the invention receives the operation instruction aiming at the virtual disk sent by the user through the graphical interface, determines the operation information according to the operation instruction, wherein the operation information at least comprises the operation type and the mapping object to which the virtual disk belongs, determines the service processing logic according to the operation information, and performs corresponding operation on the virtual disk based on the service processing logic. And receiving an operation instruction sent by a user through a graphical interface, and then performing corresponding operation on the virtual disk according to the operation instruction, so that the user can manage the virtual disk conveniently, and the virtual disk management efficiency is improved.
In a specific embodiment of the present invention, the service processing logic determining module 1103 is specifically configured to:
when the operation information is that virtual disk list viewing operation is performed on the virtual disk in the repository, the determined service processing logic is as follows:
determining a first repository of a virtual disk list to be viewed by calling a XenAPI interface according to the repository identification code;
acquiring a virtual disk list of a first repository by calling a XenAPI (application programming interface);
packaging the virtual disk list of the first repository and returning the virtual disk list to the graphical interface;
in a specific embodiment of the present invention, the service processing logic determining module 1103 is specifically configured to:
when the operation information is that virtual disk list viewing operation is performed on a virtual disk under a virtual machine, the determined service processing logic is as follows:
according to the virtual machine identification code, a first virtual machine of a virtual disk list to be viewed is determined by calling a XenAPI interface;
acquiring a virtual disk list of a first virtual machine by calling a XenAPI (application program interface);
if the first virtual machine has the virtual block equipment to be processed, acquiring virtual disk information corresponding to the virtual block equipment to be processed, and adding the virtual disk information to a virtual disk list of the first virtual machine;
and packaging the virtual disk list of the first virtual machine and returning the packaged virtual disk list to the graphical interface.
In a specific embodiment of the present invention, the service processing logic determining module 1103 is specifically configured to:
when the operation information is the virtual disk adding operation under the repository, the determined service processing logic is as follows:
acquiring a current selectable first storage library list by calling a XenAPI interface;
receiving and analyzing a first adding parameter of a user, and determining a second repository to which a virtual disk is to be added in a first repository list;
a first virtual disk is created in the second repository by calling the XenAPI interface.
In a specific embodiment of the present invention, the service processing logic determining module 1103 is specifically configured to:
when the operation information is that virtual disk adding operation is performed under the virtual machine, the determined service processing logic is as follows:
acquiring a current optional second storage library list by calling a XenAPI interface;
receiving and analyzing a second adding parameter of the user, and determining a third repository to which the virtual disk is to be added in a second repository list;
creating a second virtual disk by calling a XenAPI interface;
receiving and analyzing configuration information of a user for the second virtual disk, and packaging the configuration information into first virtual block equipment;
the first virtual block device is added by calling the XenAPI interface.
In a specific embodiment of the present invention, the service processing logic determining module 1103 is specifically configured to:
when the operation information is that virtual disk connection operation is performed under the virtual machine, the determined service processing logic is as follows:
obtaining an optional virtual disk list by calling a XenAPI interface;
receiving and analyzing the connection parameters of the user, and packaging the connection parameters into second virtual block equipment;
adding a second virtual block device by calling a XenAPI interface;
and when the second virtual block device fails to be added and the second virtual block device allows the plug operation, the plug operation is carried out by calling the XenAPI interface.
In a specific embodiment of the present invention, the service processing logic determining module 1103 is specifically configured to:
when the operation information is that the virtual disk separation operation is performed under the virtual machine, the determined service processing logic is as follows:
determining whether a virtual machine connected with each virtual block device to be processed is a second virtual machine to be subjected to virtual disk separation or not and whether the virtual block device allows unprug operation or not, and if so, calling a XenAPI interface to perform unprug operation;
and carrying out destruction operation by calling a XenAPI interface.
In a specific embodiment of the present invention, the service processing logic determining module 1103 is specifically configured to:
when the operation information is the virtual disk moving operation under the storage library or the virtual machine, the determined service processing logic is as follows:
determining a third virtual disk to be moved and a third storage library to which the virtual disk can be moved;
copying the third virtual disk into a fourth virtual disk by calling a XenAPI interface, and moving the fourth virtual disk to a third repository;
judging whether the type of the fourth virtual disk is a suspend type;
if the first virtual disk is the second virtual disk, traversing the suspend-type virtual disks in the virtual machines to obtain a second virtual disk;
and destroying the third virtual disk by calling a XenAPI interface.
In a specific embodiment of the present invention, the service processing logic determining module 1103 is specifically configured to:
when the operation information is the virtual disk modification operation under the storage library or the virtual machine, the determined service processing logic is as follows:
determining a fifth virtual disk to be modified by calling a XenAPI interface according to the virtual disk identification code;
and for each attribute which is contained in the parameter list and allowed to be modified, when the attribute value of the attribute is determined to be different from the attribute value of the fifth virtual disk, saving the modified attribute in the database by calling the XenAPI interface.
In a specific embodiment of the present invention, the service processing logic determining module 1103 is specifically configured to:
when the operation information is that the virtual disk deletion operation is performed under the storage library or the virtual machine, the determined service processing logic is as follows:
determining a sixth virtual disk to be deleted by calling a XenAPI interface according to the virtual disk identification code;
acquiring a virtual block device list corresponding to the sixth virtual disk by calling a XenAPI (application program interface);
newly building an empty virtual machine snapshot list to be deleted;
for each virtual block device in the virtual block device list, acquiring corresponding virtual machine information by calling a XenAPI (application program interface);
if the virtual machine information is not null, calling a virtual disk separation interface to separate the virtual disk from the virtual machine;
if the virtual machine is not a snapshot or the virtual machine information is not in the to-be-deleted virtual machine snapshot list, adding the snapshot information of the virtual machine into the to-be-deleted virtual machine snapshot list;
destroying the sixth virtual machine disk by calling a XenAPI interface;
and if the virtual machine snapshot list to be deleted is not empty, calling a snapshot deletion interface to delete all the snapshots in the virtual machine snapshot list to be deleted.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The principle and the implementation of the present invention are explained in the present application by using specific examples, and the above description of the embodiments is only used to help understanding the technical solution and the core idea of the present invention. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.

Claims (7)

1. A virtual disk management method is characterized by comprising the following steps:
receiving an operation instruction aiming at the virtual disk, which is sent by a user through a graphical interface;
determining operation information according to the operation instruction, wherein the operation information at least comprises an operation type and a mapping object to which the virtual disk belongs;
determining a service processing logic according to the operation information;
based on the service processing logic, performing corresponding operation on the virtual disk;
determining a service processing logic according to the operation information, including:
when the operation information is the virtual disk adding operation performed under the repository, the determined service processing logic is as follows:
acquiring a current selectable first storage library list by calling a XenAPI interface;
receiving and analyzing a first adding parameter of the user, and determining a second repository to which a virtual disk is to be added in the first repository list;
creating a first virtual disk in the second repository by calling the XenAPI interface;
when the operation information is that virtual disk list viewing operation is performed on a virtual disk in a repository, the determined service processing logic is as follows:
determining a first repository of a virtual disk list to be viewed by calling a XenAPI interface according to the repository identification code;
acquiring a virtual disk list of the first repository by calling the XenAPI interface;
packaging the virtual disk list of the first repository and returning the virtual disk list to the graphical interface;
when the operation information is that virtual disk list viewing operation is performed on a virtual disk under a virtual machine, the determined service processing logic is as follows:
according to the virtual machine identification code, a first virtual machine of a virtual disk list to be viewed is determined by calling a XenAPI interface;
acquiring a virtual disk list of the first virtual machine by calling the XenAPI;
if the first virtual machine has virtual block equipment to be processed, acquiring virtual disk information corresponding to the virtual block equipment to be processed, and adding the virtual disk information to a virtual disk list of the first virtual machine;
packaging the virtual disk list of the first virtual machine and returning the packaged virtual disk list to the graphical interface;
wherein, the determining the service processing logic according to the operation information includes:
when the operation information is that virtual disk adding operation is performed under the virtual machine, the determined service processing logic is as follows:
acquiring a current optional second storage library list by calling a XenAPI interface;
receiving and analyzing a second adding parameter of the user, and determining a third repository to which the virtual disk is to be added in the second repository list;
creating a second virtual disk by calling the XenAPI interface;
receiving and analyzing the configuration information of the user for the second virtual disk, and packaging the configuration information into first virtual block equipment;
and adding the first virtual block device by calling the XenAPI interface.
2. The virtual disk management method according to claim 1, wherein the determining a service processing logic according to the operation information includes:
when the operation information is that virtual disk connection operation is performed under a virtual machine, the determined service processing logic is as follows:
obtaining an optional virtual disk list by calling a XenAPI interface;
receiving and analyzing the connection parameters of the user, and packaging the connection parameters into second virtual block equipment;
adding the second virtual block device by calling the XenAPI interface;
and when the addition of the second virtual block equipment fails and the second virtual block equipment allows plug operation, the plug operation is carried out by calling the XenAPI.
3. The virtual disk management method according to claim 1, wherein the service processing logic determined according to the operation information includes:
when the operation information is that virtual disk separation operation is performed under a virtual machine, the determined service processing logic is as follows:
determining whether a virtual machine connected with each virtual block device to be processed is a second virtual machine to be subjected to virtual disk separation or not and whether the virtual block device allows unprug operation or not, and if so, calling a XenAPI interface to perform unprug operation;
and carrying out destruction operation by calling the XenAPI interface.
4. The virtual disk management method according to claim 1, wherein the determining a service processing logic according to the operation information includes:
when the operation information is the virtual disk moving operation under the repository or the virtual machine, the determined service processing logic is as follows:
determining a third virtual disk to be moved and a third storage library to which the virtual disk can be moved;
copying the third virtual disk into a fourth virtual disk by calling a XenAPI (application program interface), and moving the fourth virtual disk to the third repository;
judging whether the type of the fourth virtual disk is a suspend type;
if so, and the suspend-type virtual disk in each traversed virtual machine is the third virtual disk, setting the third virtual disk as the fourth virtual disk;
and destroying the third virtual disk by calling the XenAPI interface.
5. The virtual disk management method according to claim 1, wherein the determining a service processing logic according to the operation information includes:
when the operation information is the virtual disk modification operation under the storage library or the virtual machine, the determined service processing logic is as follows:
determining a fifth virtual disk to be modified by calling a XenAPI interface according to the virtual disk identification code;
and for each attribute which is contained in the parameter list and allowed to be modified, when the attribute value of the attribute is determined to be different from the attribute value of the fifth virtual disk, the modified attribute is saved in a database by calling the XenAPI interface.
6. The virtual disk management method according to claim 1, wherein the determining a service processing logic according to the operation information includes:
when the operation information is that virtual disk deletion operation is performed under a storage library or a virtual machine, the determined service processing logic is as follows:
determining a sixth virtual disk to be deleted by calling a XenAPI interface according to the virtual disk identification code;
acquiring a virtual block device list corresponding to the sixth virtual disk by calling the XenAPI;
newly building an empty virtual machine snapshot list to be deleted;
for each virtual block device in the virtual block device list, acquiring corresponding virtual machine information by calling the XenAPI;
if the virtual machine information is not null, calling a virtual disk separation interface to separate the virtual disk from the virtual machine;
if the virtual machine is not a snapshot or the virtual machine information is not in the to-be-deleted virtual machine snapshot list, adding the snapshot information of the virtual machine into the to-be-deleted virtual machine snapshot list;
destroying the sixth virtual disk by calling the XenAPI interface;
and if the virtual machine snapshot list to be deleted is not empty, calling a snapshot deletion interface to delete all snapshots in the virtual machine snapshot list to be deleted.
7. A virtual disk management apparatus, comprising:
the operation instruction receiving module is used for receiving an operation instruction which is sent by a user through a graphical interface and aims at the virtual disk;
an operation information determining module, configured to determine operation information according to the operation instruction, where the operation information at least includes an operation type and a mapping object to which the virtual disk belongs;
the service processing logic determining module is used for determining service processing logic according to the operation information;
the operation processing module is used for carrying out corresponding operation on the virtual disk based on the service processing logic;
the service processing logic determination module is specifically configured to:
when the operation information is the virtual disk adding operation performed under the repository, the determined service processing logic is as follows:
acquiring a current selectable first storage library list by calling a XenAPI interface;
receiving and analyzing a first adding parameter of the user, and determining a second repository to which a virtual disk is to be added in the first repository list;
creating a first virtual disk in the second repository by calling the XenAPI interface;
when the operation information is that virtual disk list viewing operation is performed on a virtual disk in a repository, the determined service processing logic is as follows:
determining a first repository of a virtual disk list to be viewed by calling a XenAPI interface according to the repository identification code;
acquiring a virtual disk list of the first repository by calling the XenAPI interface;
packaging the virtual disk list of the first repository and returning the virtual disk list to the graphical interface;
when the operation information is that virtual disk list viewing operation is performed on a virtual disk under a virtual machine, the determined service processing logic is as follows:
according to the virtual machine identification code, a first virtual machine of a virtual disk list to be viewed is determined by calling a XenAPI interface;
acquiring a virtual disk list of the first virtual machine by calling the XenAPI;
if the first virtual machine has virtual block equipment to be processed, acquiring virtual disk information corresponding to the virtual block equipment to be processed, and adding the virtual disk information to a virtual disk list of the first virtual machine;
packaging the virtual disk list of the first virtual machine and returning the packaged virtual disk list to the graphical interface;
when the operation information is that virtual disk adding operation is performed under the virtual machine, the determined service processing logic is as follows:
acquiring a current optional second storage library list by calling a XenAPI interface;
receiving and analyzing a second adding parameter of the user, and determining a third repository to which the virtual disk is to be added in the second repository list;
creating a second virtual disk by calling the XenAPI interface;
receiving and analyzing the configuration information of the user for the second virtual disk, and packaging the configuration information into first virtual block equipment;
and adding the first virtual block device by calling the XenAPI interface.
CN201710766056.1A 2017-08-30 2017-08-30 Virtual disk management method and device Active CN107577426B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710766056.1A CN107577426B (en) 2017-08-30 2017-08-30 Virtual disk management method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710766056.1A CN107577426B (en) 2017-08-30 2017-08-30 Virtual disk management method and device

Publications (2)

Publication Number Publication Date
CN107577426A CN107577426A (en) 2018-01-12
CN107577426B true CN107577426B (en) 2021-06-11

Family

ID=61030600

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710766056.1A Active CN107577426B (en) 2017-08-30 2017-08-30 Virtual disk management method and device

Country Status (1)

Country Link
CN (1) CN107577426B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107688442B (en) * 2017-09-04 2020-11-20 苏州浪潮智能科技有限公司 Virtual block management method for solid state disk

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102194010B (en) * 2011-06-16 2013-01-02 华中科技大学 Zero-copy defragmentation method for virtual file system fragments
CN103065102B (en) * 2012-12-26 2015-05-27 中国人民解放军国防科学技术大学 Data encryption mobile storage management method based on virtual disk
CN103699430A (en) * 2014-01-06 2014-04-02 山东大学 Working method of remote KVM (Kernel-based Virtual Machine) management system based on J2EE (Java 2 Platform Enterprise Edition) framework

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ExtraSubst4.7 绿色版;华军软件园;《ExtraSubst》;20100205;全文 *

Also Published As

Publication number Publication date
CN107577426A (en) 2018-01-12

Similar Documents

Publication Publication Date Title
US10474438B2 (en) Intelligent cloud engineering platform
CN109104467B (en) Development environment construction method and device, platform system and storage medium
JP5598762B2 (en) Virtual machine package generation system, virtual machine package generation method, and virtual machine package generation program
CN109445869B (en) Cross-cloud-adaptive micro-service management method and device and storage medium
JP7231681B2 (en) Function extension method and system for package file
CN109918055B (en) Application program generation method and device
US9378039B2 (en) Virtual machine storage replication schemes
CN102402446A (en) Method and device for installing application software
CN111343181A (en) Message processing method and system, data pool and computer readable storage medium
CN109814946B (en) Method and device for realizing distributed storage in XenServer
US11321090B2 (en) Serializing and/or deserializing programs with serializable state
US11182180B2 (en) Previewing application user interface for multiple locales
CN108287894B (en) Data processing method, device, computing equipment and storage medium
WO2022148185A1 (en) Data packet updating method and apparatus, electronic device, and readable storage medium
CN107526623B (en) Data processing method and device
US10929162B2 (en) Virtual machine container for applications
CN110362341B (en) Business management method, device, equipment and storage medium based on micro-service architecture
CN107577426B (en) Virtual disk management method and device
US11263297B2 (en) Dynamic insertion of variablized secrets in a pipeline integration system
US11537523B2 (en) Command result caching for building application container images
CN106126115A (en) A kind of method and device of the disk of EVM(extended virtual machine)
US11909640B2 (en) Creating endpoints
CN108304230B (en) Implementation method and device for adjusting application attribute and readable storage medium
CN110290172B (en) Container application cloning method and device, computer equipment and storage medium
US11196766B2 (en) Detecting denial of service attacks in serverless computing

Legal Events

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