CN109542588B - Method and device for managing virtual equipment in cloud environment - Google Patents
Method and device for managing virtual equipment in cloud environment Download PDFInfo
- Publication number
- CN109542588B CN109542588B CN201811427576.0A CN201811427576A CN109542588B CN 109542588 B CN109542588 B CN 109542588B CN 201811427576 A CN201811427576 A CN 201811427576A CN 109542588 B CN109542588 B CN 109542588B
- Authority
- CN
- China
- Prior art keywords
- virtual
- virtual machine
- state data
- data file
- node
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 18
- 238000010586 diagram Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application discloses a method and a device for managing virtual equipment in a cloud environment. The method comprises the following steps: when an operation request for deleting the first virtual machine is received, saving a state data file of the virtual equipment of the first virtual machine to be deleted in the block equipment node; when a second virtual machine is created on a computing node, configuring virtual equipment of the created second virtual machine by adopting a state data file of the virtual equipment of a first virtual machine, which is stored in a block equipment node; and the virtual equipment of the second virtual machine is the virtual equipment of the first virtual machine. Since the state data file of the virtual device of the first virtual machine is saved when the first virtual machine is deleted, after the first virtual machine is deleted, when a new virtual machine needs to be created and the virtual device of the new virtual machine is the virtual device of the first virtual machine, the virtual device of the deleted virtual machine can be provided for the newly created virtual machine to use, and the new virtual device does not need to be created.
Description
Technical Field
The present application relates to the field of virtualization, and in particular, to a method and apparatus for managing virtual devices in a cloud environment.
Background
With the rise of cloud computing, many users select resources such as computing, storage, network and the like in the cloud to construct a computing environment at the present stage. As a support technology of cloud computing, a virtualization technology has implemented functions of most physical devices, such as a video card, a network card, a sound card, and the like, so that a user can apply functions that are comparable to those of a physical environment in a cloud environment.
At present, some virtual devices (e.g., vTPM devices) of a virtual machine need to store state data in a state data file in a disk, a virtual machine simulator reads the state data for the virtual device to use each time the virtual machine is started, and the virtual device stores the data in the file to store the data when the virtual device runs under certain conditions (e.g., when the state data during running changes). In a cloud environment, all disk files of a virtual machine have the same life cycle as the virtual machine, that is, when the cloud management platform creates the virtual machine, required state data files are simultaneously distributed, and when the cloud management platform deletes the virtual machine, the state data files are simultaneously deleted. Therefore, the use scenes of users are limited, so that the virtual equipment is tightly coupled with the virtual machine, the virtual machine cannot be transferred to other virtual machines to continue using the equipment after being destroyed, and only new virtual equipment can be created again.
Disclosure of Invention
In order to solve the technical problem, the present application provides a method and an apparatus for managing virtual devices in a cloud environment, which can provide virtual devices of deleted virtual machines for new virtual machines to use, without creating new virtual devices.
In order to achieve the purpose of the present application, an embodiment of the present invention provides a method for managing virtual devices in a cloud environment, where the method includes:
when an operation request for deleting the first virtual machine is received, saving a state data file of the virtual equipment of the first virtual machine to be deleted in the block equipment node;
when a second virtual machine is created on a computing node, configuring virtual equipment of the created second virtual machine by adopting a state data file of the virtual equipment of a first virtual machine, which is stored in a block equipment node; and the virtual equipment of the second virtual machine is the virtual equipment of the first virtual machine.
Further, in an optional embodiment, when creating the second virtual machine on the computing node, before the step of configuring the virtual device of the created second virtual machine with the state data file of the virtual device of the first virtual machine saved in the block device node, the method further includes:
when receiving an operation request for creating a second virtual machine, judging whether to use an existing state data file in a block device node as a state data file of a virtual device of the second virtual machine:
if one state data file already saved in the block device node is used as the state data file of the virtual device of the second virtual machine, the created virtual device of the second virtual machine is configured with the state data file of the virtual device of the first virtual machine saved in the block device node.
Further, in an optional embodiment, the method further comprises:
if it is determined that the state data file saved in the block device node is not used as the state data file of the virtual device of the second virtual machine, the state data file of the virtual device of the second virtual machine is created in the block device node.
Further, in an optional embodiment, the step of saving, in the block device node, the state data file of the virtual device of the first virtual machine to be deleted includes:
judging whether to create a snapshot file for the state data file of the virtual equipment of the first virtual machine to be deleted:
if the snapshot file is created, after creating the snapshot file for the state data file of the virtual device of the virtual machine to be deleted, merging the created snapshot file with the state data file of the virtual device of the first virtual machine to be deleted, and saving the merged state data file in the block device node.
To achieve the objective of the present application, an embodiment of the present invention provides an apparatus for managing virtual devices in a cloud environment, the apparatus including a memory and a processor,
a memory for storing computer readable instructions;
a processor for executing computer readable instructions to perform operations comprising:
when an operation request for deleting the first virtual machine is received, saving a state data file of the virtual equipment of the first virtual machine to be deleted in the block equipment node;
when a second virtual machine is created on a computing node, configuring virtual equipment of the created second virtual machine by adopting a state data file of the virtual equipment of a first virtual machine, which is stored in a block equipment node; and the virtual equipment of the second virtual machine is the virtual equipment of the first virtual machine.
Further, in an alternative embodiment, the processor is further configured to:
when a second virtual machine is created on a computing node, before the operation of the virtual device of the created second virtual machine is configured by adopting the state data file of the virtual device of the first virtual machine saved in the block device node, when an operation request for creating the second virtual machine is received, whether to use the state data file existing in the block device node as the state data file of the virtual device of the second virtual machine is judged:
if one state data file already saved in the block device node is used as the state data file of the virtual device of the second virtual machine, the created virtual device of the second virtual machine is configured with the state data file of the virtual device of the first virtual machine saved in the block device node.
Further, in an alternative embodiment, the processor is further configured to:
if it is determined that the state data file saved in the block device node is not used as the state data file of the virtual device of the second virtual machine, the state data file of the virtual device of the second virtual machine is created in the block device node.
Further, in an optional embodiment, the operation of saving the state data file of the virtual device of the first virtual machine to be deleted in the block device node includes:
judging whether to create a snapshot file for the state data file of the virtual equipment of the first virtual machine to be deleted:
if the snapshot file is created, after creating the snapshot file for the state data file of the virtual device of the virtual machine to be deleted, merging the created snapshot file with the state data file of the virtual device of the first virtual machine to be deleted, and saving the merged state data file in the block device node.
The embodiment of the invention has the advantages that the state data file of the virtual equipment of the first virtual machine is saved when the first virtual machine is deleted, so that after the first virtual machine is deleted, when a new virtual machine needs to be created and the virtual equipment of the new virtual machine is the virtual equipment of the first virtual machine, the virtual equipment of the first virtual machine can be recycled for a virtual machine user to transfer the virtual equipment to a second virtual machine for use.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
The accompanying drawings are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the example serve to explain the principles of the invention and not to limit the invention.
Fig. 1 is a flowchart of a method for managing virtual devices in a cloud environment according to an embodiment of the present invention;
fig. 2 is a block diagram of an apparatus for managing virtual devices in a cloud environment according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
The steps illustrated in the flow charts of the figures may be performed in a computer system such as a set of computer-executable instructions. Also, while a logical order is shown in the flow diagrams, in some cases, the steps shown or described may be performed in an order different than here.
In order to solve the above problem, in one aspect, an embodiment of the present invention provides a method for managing virtual devices in a cloud environment, where, as shown in fig. 1, the method includes steps S101 to S103.
Step S101, when receiving an operation request for deleting the first virtual machine, saving a state data file of the virtual device of the first virtual machine to be deleted in the block device node.
The scheme provided by the embodiment of the invention is applied to a cloud environment, for example, the scheme can be applied to an OpenStack platform environment. When receiving an operation request for deleting a first virtual machine in the OpenStack platform, which is input by a user through, for example, a Horizon component of the OpenStack platform, first saving a state data file of a virtual device of the first virtual machine to be deleted in a block device node in the OpenStack platform, for example, saving the state data file of the virtual device in the block device node by using a shader component in the OpenStack platform. After saving the state data file of the virtual device, deleting other files of the first virtual machine. When a plurality of virtual machines are deleted, the state data file of the virtual device of each of the deleted virtual machines may be saved, that is, a plurality of state data files are saved in the block device node.
Step S103, when a second virtual machine is created on the computing node, configuring the virtual equipment of the created second virtual machine by adopting the state data file of the virtual equipment of the first virtual machine stored in the block equipment node; and the virtual equipment of the second virtual machine is the virtual equipment of the first virtual machine.
When a new virtual machine (second virtual machine) is created on the computing node and the virtual device applied by the second virtual machine is the virtual device of the first virtual machine, the virtual device of the second virtual machine can be configured by using the state data file of the virtual device of the first virtual machine saved in the block computing node as the state data file of the virtual device of the second virtual machine. In this way, reinitializing a new virtual device for use by the second virtual machine may be avoided.
The embodiment of the invention has the advantages that the state data file of the virtual equipment of the first virtual machine is saved when the first virtual machine is deleted, so that after the first virtual machine is deleted, when a new virtual machine needs to be created and the virtual equipment of the new virtual machine is the virtual equipment of the first virtual machine, the virtual equipment of the first virtual machine can be recycled for a virtual machine user to transfer the virtual equipment to a second virtual machine for use.
In an optional embodiment, in order to provide the option of saving the state data file of the virtual device to the user, the solution of the embodiment of the present invention further sets a step of determining whether to use the saved state data file before step S103:
when receiving an operation request for creating the second virtual machine, firstly judging whether to use the saved state data file as the state data file of the second virtual machine:
in an optional embodiment, if it is determined that the second virtual machine is not modified by using the saved state data file as the state data file of the virtual device of the second virtual machine when the operation request for creating the second virtual machine is received, a new state data file of the virtual device of the second virtual machine is created in the block device node to be used by the virtual device of the second virtual machine.
After the virtual machines are created in the compute node, the state data file for the virtual devices of the first virtual machine (i.e., the state data file for the virtual devices of the second virtual machine) is assigned to the virtual devices of the second virtual machine to configure the virtual devices of the second virtual machine. After this, the virtual machine may be started.
In order to restore the state data file to a normal state when the state data file of the virtual device is in error, in an alternative embodiment, the step S101 includes:
judging whether to create a snapshot file for the state data file of the virtual equipment of the first virtual machine to be deleted:
if the snapshot file is created, after the snapshot file is created for the state data file of the virtual device of the virtual machine to be deleted, the created snapshot file is merged with the state data file of the virtual device of the first virtual machine to be deleted, so that the merged state data file stores the latest state data of the virtual device of the first virtual machine to be deleted, and the virtual device can be smoothly configured by using the state data file when other virtual machines reuse the virtual device; and after merging the state data files, saving the merged state data files in the block device nodes;
if the snapshot file is not created, the state data file is saved directly in the block device node.
After saving the state data file, other resources of the virtual machine are deleted.
In order to solve the above technical problem, an embodiment of the present invention provides an apparatus for managing virtual devices in a cloud environment, as shown in fig. 2, the apparatus includes a memory 10 and a processor 20.
A memory 10 for storing computer readable instructions;
a processor 20 for executing computer readable instructions to perform the following operations:
when an operation request for deleting the first virtual machine is received, saving a state data file of the virtual equipment of the first virtual machine to be deleted in the block equipment node;
when a second virtual machine is created on a computing node, configuring virtual equipment of the created second virtual machine by adopting a state data file of the virtual equipment of a first virtual machine, which is stored in a block equipment node; and the virtual equipment of the second virtual machine is the virtual equipment of the first virtual machine.
The embodiment of the invention has the advantages that the state data file of the virtual equipment of the first virtual machine is saved when the first virtual machine is deleted, so that after the first virtual machine is deleted, when a new virtual machine needs to be created and the virtual equipment of the new virtual machine is the virtual equipment of the first virtual machine, the virtual equipment of the first virtual machine can be recycled for a virtual machine user to transfer the virtual equipment to a second virtual machine for use.
Further, in an alternative embodiment, processor 20 is further configured to perform the following operations:
when a second virtual machine is created on a computing node, before the operation of the virtual device of the created second virtual machine is configured by adopting the state data file of the virtual device of the first virtual machine saved in the block device node, when an operation request for creating the second virtual machine is received, whether to use the state data file existing in the block device node as the state data file of the virtual device of the second virtual machine is judged:
if one state data file already saved in the block device node is used as the state data file of the virtual device of the second virtual machine, the created virtual device of the second virtual machine is configured with the state data file of the virtual device of the first virtual machine saved in the block device node.
Further, in an alternative embodiment, processor 20 is further configured to perform the following operations:
if it is determined that the state data file saved in the block device node is not used as the state data file of the virtual device of the second virtual machine, the state data file of the virtual device of the second virtual machine is created in the block device node.
Further, in an optional embodiment, the operation of saving the state data file of the virtual device of the first virtual machine to be deleted in the block device node includes:
judging whether to create a snapshot file for the state data file of the virtual equipment of the first virtual machine to be deleted:
if the snapshot file is created, after creating the snapshot file for the state data file of the virtual device of the virtual machine to be deleted, merging the created snapshot file with the state data file of the virtual device of the first virtual machine to be deleted, and saving the merged state data file in the block device node.
Although the embodiments of the present invention have been described above, the above description is only for the convenience of understanding the present invention, and is not intended to limit the present invention. It will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.
Claims (6)
1. A method for managing virtual appliances in a cloud environment, the method comprising:
when an operation request for deleting the first virtual machine is received, saving a state data file of the virtual equipment of the first virtual machine to be deleted in the block equipment node;
when a second virtual machine is created on a computing node, configuring virtual equipment of the created second virtual machine by adopting a state data file of the virtual equipment of a first virtual machine, which is stored in a block equipment node; the virtual device of the second virtual machine is the virtual device of the first virtual machine;
wherein the step of saving the state data file of the virtual device of the first virtual machine to be deleted in the block device node comprises:
judging whether to create a snapshot file for the state data file of the virtual equipment of the first virtual machine to be deleted:
if the snapshot file is created, after creating the snapshot file for the state data file of the virtual device of the virtual machine to be deleted, merging the created snapshot file with the state data file of the virtual device of the first virtual machine to be deleted, and saving the merged state data file in the block device node.
2. The method of claim 1, wherein prior to the step of configuring the virtual appliance of the created second virtual machine with the state data file of the virtual appliance of the first virtual machine saved in the block appliance node when the second virtual machine is created on the compute node, the method further comprises:
when receiving an operation request for creating a second virtual machine, judging whether to use an existing state data file in the block device node as a state data file of a virtual device of the second virtual machine:
and if one state data file saved in the block device node is used as the state data file of the virtual device of the second virtual machine, configuring the created virtual device of the second virtual machine by using the state data file of the virtual device of the first virtual machine saved in the block device node.
3. The method of claim 2, further comprising:
creating a state data file of a virtual device of the second virtual machine in the block device node if it is determined not to use the state data file saved in the block device node as the state data file of the virtual device of the second virtual machine.
4. An apparatus for managing virtual devices in a cloud environment, comprising a memory and a processor,
the memory to store computer readable instructions;
the processor to execute the computer-readable instructions to perform operations comprising:
when an operation request for deleting the first virtual machine is received, saving a state data file of the virtual equipment of the first virtual machine to be deleted in the block equipment node;
when a second virtual machine is created on a computing node, configuring virtual equipment of the created second virtual machine by adopting a state data file of the virtual equipment of a first virtual machine, which is stored in a block equipment node; the virtual device of the second virtual machine is the virtual device of the first virtual machine;
wherein the operation of saving the state data file of the virtual device of the first virtual machine to be deleted in the block device node comprises:
judging whether to create a snapshot file for the state data file of the virtual equipment of the first virtual machine to be deleted:
and if the snapshot file is created, merging the created snapshot file with the state data file of the virtual device of the first virtual machine to be deleted after the snapshot file is created for the state data file of the virtual device of the virtual machine to be deleted, and saving the merged state data text in the block device node.
5. The apparatus of claim 4, wherein the processor is further configured to:
when an operation request for creating a second virtual machine is received before configuring the operation of the virtual device of the created second virtual machine by using the state data file of the virtual device of the first virtual machine, which is stored in the block device node, when the second virtual machine is created on the computing node, whether to use the state data file existing in the block device node as the state data file of the virtual device of the second virtual machine is judged:
and if one state data file saved in the block device node is used as the state data file of the virtual device of the second virtual machine, configuring the created virtual device of the second virtual machine by using the state data file of the virtual device of the first virtual machine saved in the block device node.
6. The apparatus of claim 5, wherein the processor is further configured to:
creating a state data file of a virtual device of the second virtual machine in the block device node if it is determined not to use the state data file saved in the block device node as the state data file of the virtual device of the second virtual machine.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811427576.0A CN109542588B (en) | 2018-11-27 | 2018-11-27 | Method and device for managing virtual equipment in cloud environment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811427576.0A CN109542588B (en) | 2018-11-27 | 2018-11-27 | Method and device for managing virtual equipment in cloud environment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109542588A CN109542588A (en) | 2019-03-29 |
CN109542588B true CN109542588B (en) | 2021-02-05 |
Family
ID=65850718
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811427576.0A Active CN109542588B (en) | 2018-11-27 | 2018-11-27 | Method and device for managing virtual equipment in cloud environment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109542588B (en) |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140007087A1 (en) * | 2012-06-29 | 2014-01-02 | Mark Scott-Nash | Virtual trusted platform module |
US20150178108A1 (en) * | 2013-12-20 | 2015-06-25 | Vmware, Inc. | Fast Instantiation of Virtual Machines |
US9588799B1 (en) * | 2015-09-29 | 2017-03-07 | Amazon Technologies, Inc. | Managing test services in a distributed production service environment |
CN105808320B (en) * | 2016-03-11 | 2018-12-04 | 四川安嵌科技有限公司 | Equipment virtualization system and method based on L inux container |
CN106775946B (en) * | 2016-12-16 | 2019-05-24 | 无锡华云数据技术服务有限公司 | A kind of virtual machine Method of Creation Process |
CN107943557B (en) * | 2017-11-18 | 2020-07-17 | 浙江网新恒天软件有限公司 | Virtual machine disk incremental snapshot method based on cloud platform |
CN108170516A (en) * | 2018-01-03 | 2018-06-15 | 浪潮(北京)电子信息产业有限公司 | Create method, apparatus, equipment and the computer readable storage medium of vTPM |
CN108733453A (en) * | 2018-05-11 | 2018-11-02 | 国网信息通信产业集团有限公司 | The operating method and system of credible cloud platform virtual credible root example |
-
2018
- 2018-11-27 CN CN201811427576.0A patent/CN109542588B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN109542588A (en) | 2019-03-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10496503B2 (en) | Healing cloud services during upgrades | |
US10445186B1 (en) | Associating a guest application within a virtual machine to create dependencies in backup/restore policy | |
CN111641515B (en) | VNF life cycle management method and device | |
CN104461744A (en) | Resource allocation method and device | |
CN110520844A (en) | Cloud management platform, virtual machine management method and its system | |
US10860375B1 (en) | Singleton coordination in an actor-based system | |
CN111124475A (en) | Method for storage management, electronic device and computer-readable storage medium | |
CN105450759A (en) | System mirror image management method and device | |
CN108319492B (en) | Method, device and system for resetting physical machine | |
JP5780377B2 (en) | Information processing system and application transfer method | |
US10318343B2 (en) | Migration methods and apparatuses for migrating virtual machine including locally stored and shared data | |
CN104793981A (en) | Online snapshot managing method and device for virtual machine cluster | |
CN110286996A (en) | Container instance IP switching method, device, computer equipment and storage medium | |
US20220206836A1 (en) | Method and Apparatus for Processing Virtual Machine Migration, Method and Apparatus for Generating Virtual Machine Migration Strategy, Device and Storage Medium | |
CN112631994A (en) | Data migration method and system | |
CN113127430B (en) | Mirror image information processing method, mirror image information processing device, computer readable medium and electronic equipment | |
CN113296891A (en) | Multi-scene knowledge graph processing method and device based on platform | |
CN112015515B (en) | Instantiation method and device of virtual network function | |
CN111431951B (en) | Data processing method, node equipment, system and storage medium | |
CN109542588B (en) | Method and device for managing virtual equipment in cloud environment | |
US10761940B2 (en) | Method, device and program product for reducing data recovery time of storage system | |
CN110782040A (en) | Method, device, equipment and medium for training tasks of pitorch | |
CN108733460B (en) | Method and apparatus for maintaining sessions for network storage devices | |
CN112889247B (en) | VNF service instantiation method and device | |
CN113590033A (en) | Information synchronization method and device of super-fusion system |
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 | ||
TA01 | Transfer of patent application right | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20210106 Address after: Building 9, No.1, guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Wuzhong District, Suzhou City, Jiangsu Province Applicant after: SUZHOU LANGCHAO INTELLIGENT TECHNOLOGY Co.,Ltd. Address before: Room 1601, floor 16, 278 Xinyi Road, Zhengdong New District, Zhengzhou City, Henan Province Applicant before: ZHENGZHOU YUNHAI INFORMATION TECHNOLOGY Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |