WO2023147738A1 - 虚拟机的数据存储方法、装置、虚拟机及存储介质 - Google Patents
虚拟机的数据存储方法、装置、虚拟机及存储介质 Download PDFInfo
- Publication number
- WO2023147738A1 WO2023147738A1 PCT/CN2022/135166 CN2022135166W WO2023147738A1 WO 2023147738 A1 WO2023147738 A1 WO 2023147738A1 CN 2022135166 W CN2022135166 W CN 2022135166W WO 2023147738 A1 WO2023147738 A1 WO 2023147738A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- files
- data
- storage
- file
- virtual machine
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1458—Management of the backup or restore process
- G06F11/1469—Backup restoration techniques
-
- 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
-
- 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
- G06F2009/45575—Starting, stopping, suspending or resuming virtual machine instances
Definitions
- the embodiments of the present application relate to the field of data storage, and in particular to a data storage method and device for a virtual machine, a virtual machine, and a non-volatile computer-readable storage medium.
- the high-availability solution for virtual machines or cloud platforms is generally provided by storage devices, using technologies such as active-active and remote replication provided by storage devices to achieve dual-use virtual machine applications by triggering the disaster recovery function of storage. live function.
- a logical unit provided by a storage device is generally used, and a file system is created on the storage space of the logical unit to provide storage space for the virtual machine.
- disaster recovery on the virtualization platform needs to use the storage device to restore the data on the logical unit first, then restore the file system, and finally restore the files in the file system, and finally restore the virtual machine system.
- the IO stack of the entire data recovery is very long, and any problem with data recovery at any level will cause data loss in the virtual machine. Therefore, how to improve the disaster recovery efficiency on the virtualization platform and ensure the high availability of virtual machines has become an urgent problem to be solved.
- An embodiment of the present application provides a data storage method for a virtual machine, including:
- Accessing the first storage area corresponding to at least two files in the storage device to record metadata information, verifying the metadata information, and obtaining a verification result
- the method also includes:
- the method also includes:
- the method also includes:
- the method also includes:
- the data storage status of the at least two files is normal, or, in response to the at least two second identification information being inconsistent, the data storage status of the at least two files is abnormal.
- the method also includes:
- the method also includes:
- Real-time detection of the data storage status of the abnormal file in response to detecting that the data storage status of the abnormal file is normal, performing data synchronization processing on the abnormal file based on the data stored in the normal file;
- the step of sending the target data to the at least two files for data storage is performed.
- a second aspect of the present application provides a data storage device for a virtual machine, including:
- An acquisition module configured to acquire a startup instruction of the virtual machine, and load the storage device based on the startup instruction
- An access module configured to access the metadata information recorded in the first storage area of the at least two files corresponding to the above-mentioned at least two files in the storage device, verify the metadata information, and obtain a verification result;
- the access module is also used for accessing the data area bitmap information recorded in the second storage area of the above-mentioned at least two files when the verification result is normal;
- a determining module configured to determine the data storage status of the above at least two files based on the bitmap information of the data area
- the sending module is configured to send target data to the at least two files for data storage when the data storage states of the at least two files are normal.
- the third aspect of the present application provides a virtual machine, including: one or more processors and one or more memories, the one or more processors are used to execute the computer of the virtual machine stored in the one or more memories Readable instructions to implement the data storage method for the virtual machine in the first aspect above.
- a fourth aspect of the present application provides a non-volatile computer-readable storage medium, including: the non-volatile computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be read by one or more processors Execute to implement the data storage method for the virtual machine in the first aspect above.
- FIG. 1 is a layout structure diagram of a virtual disk provided in one or more embodiments of the present application
- Fig. 2 is a data storage structure diagram of a third storage area provided in one or more embodiments of the present application.
- FIG. 3 is a schematic flowchart of a data storage method for a virtual machine provided in one or more embodiments of the present application;
- FIG. 4 is a schematic flowchart of another data storage method for a virtual machine provided in one or more embodiments of the present application.
- FIG. 5 is a schematic structural diagram of a data storage device of a virtual machine provided in one or more embodiments of the present application;
- Fig. 6 is a schematic structural diagram of a virtual machine provided in one or more embodiments of the present application.
- Figure 1 is a layout structure diagram of a virtual disk provided by the embodiment of the present application. As shown in Figure 1, it includes a virtual machine, a virtual disk management module, and a virtual disk, and the virtual disk management module is used to implement the data storage method of the virtual machine.
- the embodiment of the present application takes two files as an example. First, it is necessary to design the layout structure of the virtual disk, and create file systems in the storage spaces on the two logical units provided by the storage device, and then create the file systems in the two file systems. Create files respectively to provide storage space for the virtual machine, and format the two files into multiple areas.
- the embodiment of the present application takes four areas as an example, including the first storage area, the second storage area, the third storage area, and the second storage area.
- the first storage area can be a superblock area, which mainly records metadata information such as the size of the virtual disk, the names of the main and backup files, etc.
- the second storage area can be a bitmap area, and the bitmap area records the bits of the data area Map information, each bit represents a section of data area, this application can default the data area to 4KB, reserve 8K data space by default, and save two bitmap data areas
- the third storage area can record the record of each updated data for the journal area
- the fourth storage area may be a data area, which stores real data of the virtual machine.
- Figure 2 is a data storage structure diagram of a third storage area provided by the embodiment of the present application. As shown in Figure 2, the third storage area is a journal area, and the data storage mode can be divided into four areas for recording metadata
- the changed historical information are: New uuid, Bitmap uuid, Last uuid, History uuid.
- New uuid is the uuid information generated when the latest metadata is changed;
- Bitmap uuid record is the uuid generated by the bitmap of the current data area;
- Last uuid is the uuid information generated by the last metadata change;
- History uuid is the last time
- the uuid information is the identification information generated by the data change, and can also include information such as the time when the data changed.
- FIG. 3 is a schematic flowchart of a data storage method for a virtual machine provided in an embodiment of the present application. As shown in FIG. 3 , the method specifically includes:
- the startup instruction of the virtual machine is obtained, and after receiving the startup instruction, the virtual machine loads the storage device, and the storage device in the embodiment of the present application may be a disk.
- the embodiment of the present application uses two files for illustration.
- storage area the first storage area can be a superblock area, since the superblock area mainly records metadata information such as the size of the virtual disk, the names of the primary and secondary files, and the above metadata information can be expressed as a uuid identifier, if two files If the uuid identifiers recorded in the two files are the same, it can be determined that the verification result is normal, indicating that the two files are the same set of primary and backup files; correspondingly, if the uuid identifiers recorded in the two files are different, it can be determined that the verification result is abnormal, indicating that the two files The files are not the master and backup files of the same group.
- the second storage area can be a bitmap area, and at the same time, it can also be generated according to the data area bitmap information recorded in the bitmap area Corresponding uuid identifiers, and then read the bitmap uuid identifiers of the two files in the third storage area (journal area), and compare whether the bitmap uuid identifiers of the two files are consistent. If they are consistent, the data storage status of the two files is determined to be normal , the data can be stored normally; if they are inconsistent, it is determined that the data storage status of the two files is abnormal, and data storage cannot be performed.
- the target data when it is determined that the data storage states of the two files are normal, the target data may be sent to the two files respectively for data storage.
- the method for storing data of a virtual machine obtains a startup instruction of the virtual machine, loads the storage device based on the startup instruction; accesses the metadata information recorded in the first storage area of the at least two files corresponding to the above-mentioned at least two files in the storage device, Verifying the metadata information to obtain a verification result; when the verification result is normal, accessing the data area bitmap information recorded in the second storage area of the above-mentioned at least two files; determining the above-mentioned at least two files based on the data area bitmap information The data storage status of the file; when the data storage status of the above-mentioned at least two files is normal, the target data is sent to the above-mentioned at least two files for data storage.
- FIG. 4 is a schematic flowchart of another method for storing data of a virtual machine provided in the embodiment of the present application. As shown in FIG. 4, the method specifically includes:
- two files before the data is stored, two files can be processed for data synchronization, and the first identification information of the third storage area of the two files can be accessed.
- the first identification information can be New uuid, Bitmap uuid, Last uuid, History uuid identification.
- the corresponding first identification information in the two files is consistent, that is, the New uuid of the primary file is consistent with the New uuid of the standby file, the Bitmap uuid of the primary file is consistent with the Bitmap uuid of the standby file, and the Last uuid of the primary file is consistent with the Last uuid of the standby file. Consistent, the History uuid of the primary file is consistent with the History uuid of the standby file, it is determined that the data stored in the two files is consistent, and data synchronization is not required.
- New uuids of the two files are both empty, it means that the two files are new files without data changes, and they can be loaded into the virtual machine process normally; if the New uuids of the two files are consistent, it is confirmed that the data of the two files is Consistent, without data synchronization.
- the New uuid of one of the files is consistent with the Last uuid or History uuid in the other file, it means that the data in this file is old data, and the data in the other file needs to be fully synchronized to this file.
- the storage device fails to load, and it is necessary to wait for manual verification and synchronization of related data .
- This problem may occur during the data storage process.
- One of the files is abnormal and no longer receives data, while the other normal file continues to store data. After a certain period of time, there is a big difference in the data of the two files. , At this time, the New uuid of one of the files is inconsistent with the Last uuid or History uuid in the other file, and it is necessary to wait for manual verification and synchronization of related data.
- the second storage area of the two files is accessed. Based on the identification information of the second storage area, Determine the file with the latest data, and synchronize the data in the file with the latest data to another file; correspondingly, access the third storage area of the two files, because the third storage area records the record of updating data every time, so it is guaranteed The data records in the third storage area of the two files are consistent, which can indicate that the data of the two files is consistent when the virtual machine is running abnormally.
- the file information of the abnormal file is recorded in the first storage area of the normal file, and the abnormal file is marked as unusable.
- one of the files may be abnormal due to reasons such as the network, and the target data cannot be normally sent to the abnormal file, and data storage cannot be performed. At this time, continue to send the target data to the abnormal file.
- the number of times the target data is sent to the abnormal file is greater than or equal to the number of times threshold (for example, 5 times), and the abnormal file still cannot successfully store data at this time, it is determined that the data storage path of the abnormal file is abnormal.
- the virtual machine When it is determined that the data storage path of the abnormal file is abnormal, the virtual machine continues to undertake the service, and continues to send target data to the normal file, so that the normal file continues to store the target data to ensure normal service of the virtual machine.
- the data storage status of the abnormal file is detected in real time. After the abnormal file is restored, the data storage status of the abnormal file can be detected to be normal. Based on the data stored in the normal file, the data is synchronized to the abnormal file. Wherein, the data synchronization direction can be determined according to the uuid in the third storage area.
- the normal file is still receiving the target data for data storage to ensure the service of the virtual machine.
- the data synchronization amount can be controlled to be greater than the data storage amount of the normal file, and the two can be completed after a certain period of time.
- the method for storing data of a virtual machine obtains a startup instruction of the virtual machine, loads the storage device based on the startup instruction; accesses the metadata information recorded in the first storage area of the at least two files corresponding to the above-mentioned at least two files in the storage device, Verifying the metadata information to obtain a verification result; when the verification result is normal, accessing the data area bitmap information recorded in the second storage area of the above-mentioned at least two files; determining the above-mentioned at least two files based on the data area bitmap information
- the data storage status of the file when the data storage status of the above-mentioned at least two files is normal, send the target data to the above-mentioned at least two files for data storage, and by this method, through the data storage method in which the above-mentioned at least two files are mutually backed up, It can improve the disaster recovery efficiency on the virtualization platform and ensure the high availability of virtual machines.
- FIG. 5 is a data storage device for a virtual machine provided in an embodiment of the present application, specifically including:
- An acquisition module 501 configured to acquire a startup instruction of a virtual machine, and load a storage device based on the startup instruction
- the access module 502 is configured to access the metadata information recorded in the first storage area of the at least two files corresponding to the storage device, verify the metadata information, and obtain a verification result;
- the access module 502 is further configured to access the data area bitmap information recorded in the second storage area of the at least two files when the verification result is normal;
- a determining module 503, configured to determine the data storage status of the above-mentioned at least two files based on the bitmap information of the data area;
- the sending module 504 is configured to send target data to the at least two files for data storage when the data storage states of the at least two files are normal.
- the accessing module 502 is specifically configured to access the first identification information of the third storage area of the above-mentioned at least two files.
- the determination module 503 is specifically configured to determine that the data stored in the at least two files are consistent if the first identification information is consistent; if the first identification information is inconsistent, determine that the data stored in the at least two files The stored data is inconsistent, and data synchronization processing is performed on the data stored in the above at least two files.
- the determining module 503 is further configured to compare the metadata information recorded in the first storage area of the at least two files; if the metadata information is consistent, then determine that the verification result is normal; if the metadata information is inconsistent , it is determined that the verification result is abnormal.
- the determination module 503 is further configured to generate the corresponding at least two second identification information based on the data area bitmap information recorded in the second storage area of the at least two files; second identification information; if the at least two second identification information are consistent, the data storage status of the at least two files is normal; if the at least two second identification information are inconsistent, the data storage status of the at least two files is normal; abnormal.
- the sending module 504 is specifically configured to send the target data to the above-mentioned at least two files for data storage, if there is any abnormal file, continue to send the target data to the abnormal file; If the number of times the file sends the target data is greater than or equal to the number of times threshold, and the abnormal file is not successfully stored in data, it is determined that the data storage path of the abnormal file is abnormal.
- the sending module 504 is also configured to send the target data to the normal file when it is determined that the data storage path of the abnormal file is abnormal, so that the normal file continues to store the target data; Data storage status, if it is detected that the data storage status of the abnormal file is normal, the abnormal file will be processed for data synchronization based on the data stored in the normal file; when the data synchronization processing is completed, the target data will be sent to at least two files for data processing. Stored steps.
- the sending module 504 is further configured to control the consistency of data in the second storage area of the at least two files and control the data in the third storage area of the at least two files when the virtual machine is running abnormally. Consistent; if one of the at least two files is abnormal, record the abnormal file information in the first storage area of the normal file.
- the data storage device of the virtual machine provided in this embodiment may be the data storage device of the virtual machine as shown in FIG. 5, and all the steps of the data storage method of the virtual machine in FIG.
- the technical effect of the data storage method of the virtual machine shown in 4 please refer to the relevant descriptions in FIGS. 3-4 for details, which are not described here for simplicity.
- FIG. 6 is a schematic structural diagram of a virtual machine provided by an embodiment of the present application.
- the virtual machine 600 shown in FIG. 6 includes: at least one processor 601 , memory 602 , at least one network interface 604 and other user interfaces 603 .
- Various components in the virtual machine 600 are coupled together through the bus system 605 .
- the bus system 605 is used to realize connection and communication among these components.
- the bus system 605 also includes a power bus, a control bus and a status signal bus.
- the various buses are labeled as bus system 605 in FIG. 6 for clarity of illustration.
- the user interface 603 may include a display, a keyboard or a pointing device (for example, a mouse, a trackball (trackball), a touch panel or a touch screen, and the like.
- a keyboard or a pointing device for example, a mouse, a trackball (trackball), a touch panel or a touch screen, and the like.
- the memory 602 in the embodiment of the present application may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories.
- the non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electronically programmable Erase Programmable Read-Only Memory (Electrically EPROM, EEPROM) or Flash.
- the volatile memory can be Random Access Memory (RAM), which acts as external cache memory.
- RAM Static Random Access Memory
- SRAM Static Random Access Memory
- DRAM Dynamic Random Access Memory
- Synchronous Dynamic Random Access Memory Synchronous Dynamic Random Access Memory
- SDRAM double data rate synchronous dynamic random access memory
- Double Data Rate SDRAM DDRSDRAM
- enhanced SDRAM ESDRAM
- Synch link DRAM SLDRAM
- Direct Memory Bus Random Access Memory Direct Rambus RAM, DRRAM
- the memory 602 described herein is intended to include, but is not limited to, these and any other suitable types of memory.
- the memory 602 stores the following elements, executable units or data structures, or their subsets, or their extended sets: operating system 6021 and computer readable instructions 6022 .
- the operating system 6021 includes various system computer-readable instructions, such as framework layer, core library layer, driver layer, etc., for realizing various basic services and processing hardware-based tasks.
- the computer-readable instructions 6022 include various computer-readable instructions, such as a media player (Media Player), a browser (Browser), etc., for realizing various application services.
- Computer-readable instructions for implementing the methods of the embodiments of the present application may be included in the application computer-readable instructions 6022 .
- the processor 601 by calling the computer-readable instructions stored in the memory 602, specifically, the computer-readable instructions stored in the computer-readable instructions 6022, the processor 601 is configured to execute the methods provided in each method embodiment Steps include, for example:
- the first identification information of the third storage area of the at least two files is accessed; if the first identification information is consistent, it is determined that the data stored in the at least two files are consistent; if the first identification information If they are inconsistent, it is determined that the data stored in the at least two files are inconsistent, and data synchronization processing is performed on the data stored in the at least two files.
- the data in the second storage area controlling the at least two files are consistent and the data in the third storage area controlling the at least two files are consistent; if the at least two If there is a file abnormality in the file, the abnormal file information is recorded in the first storage area of the normal file.
- the metadata information recorded in the first storage area of the at least two files is compared; if the metadata information is consistent, it is determined that the verification result is normal; if the metadata information is inconsistent, it is determined that the verification result is abnormal .
- based on the data area bitmap information recorded in the second storage area of the at least two files generate the corresponding at least two second identification information; compare the at least two second identification information; if If the at least two second identification information are consistent, the data storage status of the at least two files is normal; if the at least two second identification information are inconsistent, the data storage status of the at least two files is abnormal.
- the process of sending the target data to the above-mentioned at least two files for data storage if there is any abnormal file, then continue to send the target data to the abnormal file; if the number of times the target data is sent to the abnormal file is greater than or equal to the number of times threshold, and the abnormal file is not successfully stored in data, it is determined that the data storage path of the abnormal file is abnormal.
- the target data is sent to the normal file, so that the normal file continues to store the target data; the data storage status of the abnormal file is detected in real time, if detected If the data storage state of the abnormal file is normal, the data synchronization process is performed on the abnormal file based on the data stored in the normal file; when the data synchronization process is completed, the step of sending the target data to the above-mentioned at least two files for data storage is performed.
- the methods disclosed in the foregoing embodiments of the present application may be applied to the processor 601 or implemented by the processor 601 .
- the processor 601 may be an integrated circuit chip and has signal processing capabilities. In the implementation process, each step of the above method may be completed by an integrated logic circuit of hardware in the processor 601 or instructions in the form of software.
- the above-mentioned processor 601 may be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a ready-made programmable gate array (Field Programmable Gate Array, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
- a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
- the steps of the method disclosed in the embodiments of the present application can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software units in the decoding processor.
- the software unit may be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
- the storage medium is located in the memory 602, and the processor 601 reads the information in the memory 602, and completes the steps of the above method in combination with its hardware.
- the processing unit can be implemented in one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processor (Digital Signal Processing, DSP), digital signal processing device (DSPDevice, DSPD), programmable logic Equipment (Programmable Logic Device, PLD), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), general-purpose processor, controller, microcontroller, microprocessor, other electronic units for performing the functions of this application or in its combination.
- ASIC Application Specific Integrated Circuits
- DSP Digital Signal Processing
- DSPDevice digital signal processing device
- PLD programmable logic Equipment
- Field-Programmable Gate Array Field-Programmable Gate Array
- FPGA Field-Programmable Gate Array
- the techniques herein may be implemented by units that perform the functions herein.
- Software codes can be stored in memory and executed by a processor.
- Memory can be implemented within the processor or external to the processor.
- the virtual machine provided by this embodiment can be a virtual machine as shown in FIG. 6, and can perform all the steps of the data storage method of the virtual machine in FIG. 3-4, and then realize the data storage of the virtual machine shown in FIG. 3-4.
- the relevant descriptions in FIGS. 3-4 please refer to the relevant descriptions in FIGS. 3-4 for details, and for the sake of brevity, details are not repeated here.
- the embodiment of the present application also provides a non-volatile computer-readable storage medium.
- the non-transitory computer readable storage medium stores one or more computer readable instructions.
- the non-volatile computer-readable storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state hard disk; the memory may also include Combinations of the above types of memory may be included.
- the processor is used to execute the computer-readable instructions of the virtual machine stored in the memory, so as to realize the following steps of the data storage method of the virtual machine executed on the virtual machine side:
- the first identification information of the third storage area of the at least two files is accessed; if the first identification information is consistent, it is determined that the data stored in the at least two files are consistent; if the first identification information If they are inconsistent, it is determined that the data stored in the at least two files are inconsistent, and data synchronization processing is performed on the data stored in the at least two files.
- the data in the second storage area controlling the at least two files are consistent and the data in the third storage area controlling the at least two files are consistent; if the at least two If there is a file abnormality in the file, the abnormal file information is recorded in the first storage area of the normal file.
- the metadata information recorded in the first storage area of the at least two files is compared; if the metadata information is consistent, it is determined that the verification result is normal; if the metadata information is inconsistent, it is determined that the verification result is abnormal .
- based on the data area bitmap information recorded in the second storage area of the at least two files generate the corresponding at least two second identification information; compare the at least two second identification information; if If the at least two second identification information are consistent, the data storage status of the at least two files is normal; if the at least two second identification information are inconsistent, the data storage status of the at least two files is abnormal.
- the process of sending the target data to the above-mentioned at least two files for data storage if there is any abnormal file, then continue to send the target data to the abnormal file; if the number of times the target data is sent to the abnormal file is greater than or equal to the number of times threshold, and the abnormal file is not successfully stored in data, it is determined that the data storage path of the abnormal file is abnormal.
- the target data is sent to the normal file, so that the normal file continues to store the target data; the data storage status of the abnormal file is detected in real time, if detected If the data storage state of the abnormal file is normal, the data synchronization process is performed on the abnormal file based on the data stored in the normal file; when the data synchronization process is completed, the step of sending the target data to the above-mentioned at least two files for data storage is performed.
- RAM random access memory
- ROM read-only memory
- EEPROM electrically programmable ROM
- EEPROM electrically erasable programmable ROM
- registers hard disk, removable disk, CD-ROM, or any other Any other known storage medium.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请公开了一种虚拟机的数据存储方法、装置、虚拟机及存储介质,包括:获取虚拟机的启动指令,基于所述启动指令加载存储设备;访问所述存储设备中对应的至少两个文件的第一存储区域记录的元数据信息,对所述元数据信息进行校验,得到校验结果;在所述校验结果正常时,访问所述至少两个文件的第二存储区域记录的数据区域位图信息;基于所述数据区域位图信息确定所述至少两个文件的数据存储状态;在所述至少两个文件的数据存储状态均正常时,向所述至少两个文件发送目标数据进行数据存储。
Description
相关申请的交叉引用
本申请要求于2022年2月7日提交中国专利局,申请号为202210115376.1,申请名称为“虚拟机的数据存储方法、装置、虚拟机及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请实施例涉及数据存储领域,尤其涉及一种虚拟机的数据存储方法、装置、虚拟机及非易失性计算机可读存储介质。
在虚拟化领域中,虚拟机或云平台的虚拟机高可用方案一般是由存储设备提供,使用存储设备提供的双活、远程复制等技术通过触发存储的容灾功能来达到虚拟机应用的双活功能。
然而,发明人意识到,在虚拟化平台上,一般使用存储设备提供的逻辑单元,在逻辑单元的存储空间上创建文件系统为虚拟机提供存储空间。而虚拟化平台上的容灾恢复需要先使用存储设备恢复逻辑单元上的数据,然后恢复文件系统,最后再恢复文件系统中的文件,最后再恢复虚拟机系统。整个数据恢复的IO栈很长,任何一个层次的数据恢复出现问题会导致虚拟机中的数据丢失。因此,如何提高虚拟化平台上的容灾恢复效率,保证虚拟机的高可用成为亟待解决的问题。
发明内容
本申请实施例提供了一种虚拟机的数据存储方法,包括:
获取虚拟机的启动指令,基于启动指令加载存储设备;
访问存储设备中对应的至少两个文件的第一存储区域记录元数据信息,对元数据信息进行校验,得到校验结果;
响应于校验结果正常,访问上述至少两个文件的第二存储区域记录的数据区域位图信息;
基于数据区域位图信息确定上述至少两个文件的数据存储状态;及
响应于上述至少两个文件的数据存储状态均正常,向上述至少两个文件发送目标数据进行数据存储。
在其中一些实施例中,该方法还包括:
访问上述至少两个文件的第三存储区域的第一标识信息;
响应于第一标识信息一致,确定上述至少两个文件中存储的数据一致;及
响应于第一标识信息不一致,确定上述至少两个文件中存储的数据不一致,对上述至少两个文件中存储的数据进行数据同步处理。
在其中一些实施例中,该方法还包括:
响应于虚拟机运行异常,控制上述至少两个文件的第二存储区域的数据一致以及控制上述至少两个文件的第三存储区域的数据一致;及
响应于上述至少两个文件中存在一个文件异常,在正常文件的第一存储区域记录异常文件信息。
在其中一些实施例中,该方法还包括:
对比上述至少两个文件的第一存储区域记录的元数据信息;及
响应于元数据信息一致,确定校验结果正常,或,响应于元数据信息不一致,确定校验结果异常。
在其中一些实施例中,该方法还包括:
基于上述至少两个文件的第二存储区域记录的数据区域位图信息,生成对应的至少两个第二标识信息;
对比上述至少两个第二标识信息;及
响应于上述至少两个第二标识信息一致,上述至少两个文件的数据存储状态正常,或,响应于上述至少两个第二标识信息不一致,上述至少两个文件的数据存储状态异常。
在其中一些实施例中,该方法还包括:
在向上述至少两个文件发送目标数据进行数据存储过程中,响应于存在任一个异常文件,继续向异常文件发送目标数据;及
响应于向异常文件发送目标数据的次数大于或等于次数阈值,且异常文件未成功进行数据存储,确定异常文件的数据存储路径异常。
在其中一些实施例中,该方法还包括:
响应于确定异常文件的数据存储路径异常,向正常文件发送目标数据,以使正常文件继续对目标数据进行数据存储;
实时检测异常文件的数据存储状态,响应于检测到异常文件的数据存储状态正常,基于正常文件中存储的数据对异常文件进行数据同步处理;及
响应于数据同步处理完成,执行向上述至少两个文件发送目标数据进行数据存储的步骤。
本申请的第二方面提供了一种虚拟机的数据存储装置,包括:
获取模块,用于获取虚拟机的启动指令,基于启动指令加载存储设备;
访问模块,用于访问存储设备中对应的上述至少两个文件的第一存储区域记录的元数据信息,对元数据信息进行校验,得到校验结果;
访问模块,还用于在校验结果正常时,访问上述至少两个文件的第二存储区域记录的数据区域位图信息;
确定模块,用于基于数据区域位图信息确定上述至少两个文件的数据存储状态;及
发送模块,用于在上述至少两个文件的数据存储状态均正常时,向上述至少两个文件发送目标数据进行数据存储。
本申请的第三方面提供了一种虚拟机,包括:一个或多个处理器和一个或多个存储器,该一个或多个处理器用于执行上述一个或多个存储器中存储的虚拟机的计算机可读指令,以实现上述第一方面中的虚拟机的数据存储方法。
本申请的第四方面提供了一种非易失性计算机可读存储介质,包括:非易失性计算机可读存储介质存储有计算机可读指令,计算机可读指令可被一个或者多个处理器执行,以实现上述第一方面中的虚拟机的数据存储方法。
图1为本申请一个或多个实施例中提供的一种虚拟磁盘的布局结构图;
图2为本申请一个或多个实施例中提供的一种第三存储区域的数据存储结 构图;
图3为本申请一个或多个实施例中提供的一种虚拟机的数据存储方法的流程示意图;
图4为本申请一个或多个实施例中提供的另一种虚拟机的数据存储方法的流程示意图;
图5为本申请一个或多个实施例中提供的一种虚拟机的数据存储装置的结构示意图;
图6为本申请一个或多个实施例中提供的一种虚拟机的结构示意图。
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
为便于对本申请实施例的理解,下面将结合附图以具体实施例做进一步的解释说明,实施例并不构成对本申请实施例的限定。
图1为本申请实施例提供的一种虚拟磁盘的布局结构图,如图1所示,包括虚拟机、虚拟磁盘管理模块、虚拟磁盘,虚拟磁盘管理模块用于对虚拟机的数据存储方法进行执行,本申请实施例以两个文件为例,首先需要对虚拟磁盘的布局结构进行设计,在存储设备提供的两个逻辑单元上的存储空间中分别创建文件系统,再在两个文件系统中分别创建文件为虚拟机提供存储空间,将两个文件均格式化为多个区域,本申请实施例以四个区域为例,包括第一存储区域、第二存储区域、第三存储区域、第四存储区域,其中,第一存储区域可以是superblock区域,主要记录虚拟磁盘的大小,主备两个文件名称等元数据信息;第二存储区域可以为bitmap区域,bitmap区域记录的是数据区域位图信息,每一位表示一段数据区域,本申请可以默认数据区域是4KB,默认预留8K的数据空间,保存两个bitmap数据区域;第三存储区域可以为journal区域记录每一次更新数据的记录;第四存储区域可以为data区域,存储虚拟机的真实数据。
图2为本申请实施例提供的一种第三存储区域的数据存储结构图,如图2所示,第三存储区域为journal区域,数据存储模式可以分为四个区域,用以记录元数据变动的历史信息,分别为:New uuid、Bitmap uuid、Last uuid、History uuid。其中,New uuid是当前最新的元数据变更时生成的uuid信息;Bitmap uuid记录是当前数据区域的bitmap生成的uuid;Last uuid是上次的元数据变化生成的uuid信息;History uuid是上上次的元数据变化生成的uuid信息;uuid信息为数据发生变化产生的标识信息,还可以包含有数据发生变化的时间等信息。
图3为本申请实施例提供的一种虚拟机的数据存储方法的流程示意图,如图3所示,该方法具体包括:
S31、获取虚拟机的启动指令,基于启动指令加载存储设备。
本申请实施例中,首先获取虚拟机的启动指令,虚拟机在接收到启动指令后,加载存储设备,本申请实施例中的存储设备可以是磁盘。
S32、访问存储设备中对应的上述至少两个文件的第一存储区域记录的元数据信息,对元数据信息进行校验,得到校验结果。
访问存储设备中对应的两个文件系统中分别创建的上述至少两个文件,本申请实施例以两个文件进行说明,该两个文件可以互为主备文件,访问两个文件对应的第一存储区域,该第一存储区域可以为superblock区域,由于superblock区域中主要记录虚拟磁盘的大小,主备两个文件名称等元数据信息,上述元数据信息可以表示为一个uuid标识,若两个文件中记录的uuid标识相同,则可以确定校验结果正常,表征两个文件为同一组主备文件;相应的,若两个文件中记录的uuid标识不同,则可以确定校验结果异常,表征两个文件不为同一组主备文件。
S33、在校验结果正常时,访问上述至少两个文件的第二存储区域记录的数据区域位图信息。
S34、基于数据区域位图信息确定上述至少两个文件的数据存储状态。
以下对S33-S34进行统一说明:
在确定两个文件为同一组主备文件时,分别读取两个文件中的第二存储区,该第二存储区域可以是bitmap区域,同时根据bitmap区域记录的数据区域位图信息也可以生成相应的uuid标识,进而读取两个文件分别在第三存储区域(journal区域)的bitmap uuid标识,比较两个文件的bitmap uuid标识是否一致, 若一致,则认定两个文件的数据存储状态正常,可正常进行数据存储;若不一致,则认定两个文件的数据存储状态异常,不可进行数据存储。
S35、在上述至少两个文件的数据存储状态均正常时,向上述至少两个文件发送目标数据进行数据存储。
本申请实施例中,在确定两个文件的数据存储状态均正常时,可以向两个文件分别发送目标数据进行数据存储。
本申请实施例提供的虚拟机的数据存储方法,通过获取虚拟机的启动指令,基于启动指令加载存储设备;访问存储设备中对应的上述至少两个文件的第一存储区域记录的元数据信息,对元数据信息进行校验,得到校验结果;在校验结果正常时,访问上述至少两个文件的第二存储区域记录的数据区域位图信息;基于数据区域位图信息确定上述至少两个文件的数据存储状态;在上述至少两个文件的数据存储状态均正常时,向上述至少两个文件发送目标数据进行数据存储,相比于现有技术中使用存储设备提供的逻辑单元,在逻辑单元的存储空间上创建文件系统为虚拟机提供存储空间,而虚拟化平台上的容灾恢复需要先使用存储设备恢复逻辑单元上的数据,然后恢复文件系统,最后再恢复文件系统中的文件,最后再恢复虚拟机系统,整个数据恢复的IO栈很长,任何一个层次的数据恢复出现问题会导致虚拟机中的数据丢失的问题,由本方法,通过上述至少两个文件互为备份的数据存储方式,可以提高虚拟化平台上的容灾恢复效率,保证虚拟机的高可用。
图4为本申请实施例提供的另一种虚拟机的数据存储方法的流程示意图,如图4所示,该方法具体包括:
S41、访问上述至少两个文件的第三存储区域的第一标识信息。
本申请实施例中,可以在数据存储之前,对两个文件进行数据同步处理,访问两个文件的第三存储区域的第一标识信息,该第一标识信息可以为New uuid、Bitmap uuid、Last uuid、History uuid标识。
S42、若第一标识信息一致,则确定上述至少两个文件中存储的数据一致。
若两个文件中分别对应的第一标识信息均一致,即主文件的New uuid与备文件New uuid一致、主文件的Bitmap uuid与备文件Bitmap uuid一致、主文件的Last uuid与备文件Last uuid一致、主文件的History uuid与备文件History uuid 一致,则确定两个文件中存储的数据一致,无需进行数据同步处理。
S43、若第一标识信息不一致,则确定上述至少两个文件中存储的数据不一致,对上述至少两个文件中存储的数据进行数据同步处理。
若两个文件的New uuid均为空,则说明两个文件是新建文件,没有数据变更,正常加载至虚拟机进程即可;若两个文件的New uuid一致,则确认两个文件的数据是一致的,无需进行数据同步。
可选的,若其中一个文件的New uuid与另一文件中Last uuid或History uuid一致,则说明该文件的数据为老旧数据,需要将另一个文件的数据全量同步至该文件中。
可选的,若其中一个文件的New uuid与另一文件中的Last uuid或History uuid都不一致,则确定两个文件中的数据不一致,则存储设备加载失败,需要等待手动校验并同步相关数据。此问题发生的情况可能是在数据存储过程中,其中一个文件出现异常,不再接收数据,而另一个正常的文件继续进行数据存储,经过一定的时间,导致两个文件的数据存在较大差异,此时导致其中一个文件的New uuid与另一文件中的Last uuid或History uuid都不一致,需要等待手动校验并同步相关数据。
S44、在虚拟机运行异常时,控制上述至少两个文件的第二存储区域的数据一致以及控制上述至少两个文件的第三存储区域的数据一致。
本申请实施例中,在数据存储过程中还可能出现虚拟机以外关机或宕机的情况,在虚拟机运行异常时,访问两个文件的第二存储区域,基于第二存储区域的标识信息,确定数据最新的文件,将数据最新的文件中的数据同步到另一文件中;相应的,访问两个文件的第三存储区域,由于第三存储区域记录每一次更新数据的记录,因此,保证两个文件的第三存储区域的数据记录一致,可以表征两个文件在虚拟机运行异常时数据一致。
S45、若上述至少两个文件中存在一个文件异常,则在正常文件的第一存储区域记录异常文件信息。
若在虚拟机运行异常时,两个文件中存在一个文件异常,则在正常文件的第一存储区域记录该异常文件的文件信息,并标记该异常文件不可用。
S46、在向上述至少两个文件发送目标数据进行数据存储过程中,若存在任 一个异常文件,则继续向异常文件发送目标数据。
本申请实施例中,在数据存储过程中还可能由于网络等原因出现其中一个文件异常,无法向该异常文件正常发送目标数据,不能进行数据存储,此时,继续向该异常文件发送目标数据。
S47、若向异常文件发送目标数据的次数大于或等于次数阈值,且异常文件未成功进行数据存储,则确定异常文件的数据存储路径异常。
若向异常文件发送目标数据的次数大于或等于次数阈值(例如,5次),此时异常文件仍然无法成功进行数据存储,则判定该异常文件的数据存储路径异常。
S48、在确定异常文件的数据存储路径异常时,向正常文件发送目标数据,以使正常文件继续对目标数据进行数据存储。
在确定异常文件的数据存储路径异常时,虚拟机继续承接服务,继续向正常文件发送目标数据,以使该正常文件继续对目标数据进行数据存储,保证虚拟机的正常服务。
S49、实时检测异常文件的数据存储状态,若检测到异常文件的数据存储状态正常,则基于正常文件中存储的数据对异常文件进行数据同步处理。
实时检测异常文件的数据存储状态,待异常文件恢复后,可以检测到异常文件的数据存储状态正常,基于正常文件中存储的数据,将数据同步到该异常文件中。其中,可以根据第三存储区域中的uuid,判断数据同步方向。
S410、在数据同步处理完成时,执行向上述至少两个文件发送目标数据进行数据存储的步骤。
本申请实施例中,数据同步过程中,正常文件仍然在接收目标数据进行数据存储,保证虚拟机的服务,此时可以控制数据同步量大于正常文件的数据存储量,经过一定的时间可以完成两个文件的数据同步,数据同步完成时,可以继续同时向两个文件发送目标数据,以使两个文件对目标数据进行数据存储。
本申请实施例提供的虚拟机的数据存储方法,通过获取虚拟机的启动指令,基于启动指令加载存储设备;访问存储设备中对应的上述至少两个文件的第一存储区域记录的元数据信息,对元数据信息进行校验,得到校验结果;在校验结果正常时,访问上述至少两个文件的第二存储区域记录的数据区域位图信息;基于数据区域位图信息确定上述至少两个文件的数据存储状态;在上述至少两个文件 的数据存储状态均正常时,向上述至少两个文件发送目标数据进行数据存储,由本方法,通过上述至少两个文件互为备份的数据存储方式,可以提高虚拟化平台上的容灾恢复效率,保证虚拟机的高可用。
图5为本申请实施例提供的一种虚拟机的数据存储装置,具体包括:
获取模块501,用于获取虚拟机的启动指令,基于启动指令加载存储设备;
访问模块502,用于访问存储设备中对应的上述至少两个文件的第一存储区域记录的元数据信息,对元数据信息进行校验,得到校验结果;
访问模块502,还用于在校验结果正常时,访问上述至少两个文件的第二存储区域记录的数据区域位图信息;
确定模块503,用于基于数据区域位图信息确定上述至少两个文件的数据存储状态;
发送模块504,用于在上述至少两个文件的数据存储状态均正常时,向上述至少两个文件发送目标数据进行数据存储。
在一个可能的实施方式中,访问模块502,具体用于访问上述至少两个文件的第三存储区域的第一标识信息。
在一个可能的实施方式中,确定模块503,具体用于若第一标识信息一致,则确定上述至少两个文件中存储的数据一致;若第一标识信息不一致,则确定上述至少两个文件中存储的数据不一致,对上述至少两个文件中存储的数据进行数据同步处理。
在一个可能的实施方式中,确定模块503,还用于对比上述至少两个文件的第一存储区域记录的元数据信息;若元数据信息一致,则确定校验结果正常;若元数据信息不一致,则确定校验结果异常。
在一个可能的实施方式中,确定模块503,还用于基于上述至少两个文件的第二存储区域记录的数据区域位图信息,生成对应的上述至少两个第二标识信息;对比上述至少两个第二标识信息;若上述至少两个第二标识信息一致,则上述至少两个文件的数据存储状态正常;若上述至少两个第二标识信息不一致,则上述至少两个文件的数据存储状态异常。
在一个可能的实施方式中,发送模块504,具体用于在向上述至少两个文件发送目标数据进行数据存储过程中,若存在任一个异常文件,则继续向异常文件 发送目标数据;若向异常文件发送目标数据的次数大于或等于次数阈值,且异常文件未成功进行数据存储,则确定异常文件的数据存储路径异常。
在一个可能的实施方式中,发送模块504,还用于在确定异常文件的数据存储路径异常时,向正常文件发送目标数据,以使正常文件继续对目标数据进行数据存储;实时检测异常文件的数据存储状态,若检测到异常文件的数据存储状态正常,则基于正常文件中存储的数据对异常文件进行数据同步处理;在数据同步处理完成时,执行向上述至少两个文件发送目标数据进行数据存储的步骤。
在一个可能的实施方式中,发送模块504,还用于在虚拟机运行异常时,控制上述至少两个文件的第二存储区域的数据一致以及控制上述至少两个文件的第三存储区域的数据一致;若上述至少两个文件中存在一个文件异常,则在正常文件的第一存储区域记录异常文件信息。
本实施例提供的虚拟机的数据存储装置可以是如图5中所示的虚拟机的数据存储装置,可执行如图3-4中虚拟机的数据存储方法的所有步骤,进而实现图3-4所示虚拟机的数据存储方法的技术效果,具体请参照图3-4相关描述,为简洁描述,在此不作赘述。
图6为本申请实施例提供的一种虚拟机的结构示意图,图6所示的虚拟机600包括:至少一个处理器601、存储器602、至少一个网络接口604和其他用户接口603。虚拟机600中的各个组件通过总线系统605耦合在一起。可理解,总线系统605用于实现这些组件之间的连接通信。总线系统605除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图6中将各种总线都标为总线系统605。
其中,用户接口603可以包括显示器、键盘或者点击设备(例如,鼠标,轨迹球(trackball)、触感板或者触摸屏等。
可以理解,本申请实施例中的存储器602可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但 不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synch link DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本文描述的存储器602旨在包括但不限于这些和任意其它适合类型的存储器。
在一些实施方式中,存储器602存储了如下的元素,可执行单元或者数据结构,或者他们的子集,或者他们的扩展集:操作系统6021和计算机可读指令6022。
其中,操作系统6021,包含各种系统计算机可读指令,例如框架层、核心库层、驱动层等,用于实现各种基础业务以及处理基于硬件的任务。计算机可读指令6022,包含各种计算机可读指令,例如媒体播放器(Media Player)、浏览器(Browser)等,用于实现各种应用业务。实现本申请实施例方法的计算机可读指令可以包含在应用计算机可读指令6022中。
在本申请实施例中,通过调用存储器602存储的计算机可读指令,具体的,可以是计算机可读指令6022中存储的计算机可读指令,处理器601用于执行各方法实施例所提供的方法步骤,例如包括:
获取虚拟机的启动指令,基于启动指令加载存储设备;访问存储设备中对应的上述至少两个文件的第一存储区域记录的元数据信息,对元数据信息进行校验,得到校验结果;在校验结果正常时,访问上述至少两个文件的第二存储区域记录的数据区域位图信息;基于数据区域位图信息确定上述至少两个文件的数据存储状态;在上述至少两个文件的数据存储状态均正常时,向上述至少两个文件发送目标数据进行数据存储。
在一个可能的实施方式中,访问上述至少两个文件的第三存储区域的第一标识信息;若第一标识信息一致,则确定上述至少两个文件中存储的数据一致;若第一标识信息不一致,则确定上述至少两个文件中存储的数据不一致,对上述至少两个文件中存储的数据进行数据同步处理。
在一个可能的实施方式中,在虚拟机运行异常时,控制上述至少两个文件的第二存储区域的数据一致以及控制上述至少两个文件的第三存储区域的数据一 致;若上述至少两个文件中存在一个文件异常,则在正常文件的第一存储区域记录异常文件信息。
在一个可能的实施方式中,对比上述至少两个文件的第一存储区域记录的元数据信息;若元数据信息一致,则确定校验结果正常;若元数据信息不一致,则确定校验结果异常。
在一个可能的实施方式中,基于上述至少两个文件的第二存储区域记录的数据区域位图信息,生成对应的上述至少两个第二标识信息;对比上述至少两个第二标识信息;若上述至少两个第二标识信息一致,则上述至少两个文件的数据存储状态正常;若上述至少两个第二标识信息不一致,则上述至少两个文件的数据存储状态异常。
在一个可能的实施方式中,在向上述至少两个文件发送目标数据进行数据存储过程中,若存在任一个异常文件,则继续向异常文件发送目标数据;若向异常文件发送目标数据的次数大于或等于次数阈值,且异常文件未成功进行数据存储,则确定异常文件的数据存储路径异常。
在一个可能的实施方式中,在确定异常文件的数据存储路径异常时,向正常文件发送目标数据,以使正常文件继续对目标数据进行数据存储;实时检测异常文件的数据存储状态,若检测到异常文件的数据存储状态正常,则基于正常文件中存储的数据对异常文件进行数据同步处理;在数据同步处理完成时,执行向上述至少两个文件发送目标数据进行数据存储的步骤。
上述本申请实施例揭示的方法可以应用于处理器601中,或者由处理器601实现。处理器601可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器601中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器601可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软 件单元组合执行完成。软件单元可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器602,处理器601读取存储器602中的信息,结合其硬件完成上述方法的步骤。
可以理解的是,本文描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSPDevice,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请功能的其它电子单元或其组合中。
对于软件实现,可通过执行本文功能的单元来实现本文的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。
本实施例提供的虚拟机可以是如图6中所示的虚拟机,可执行如图3-4中虚拟机的数据存储方法的所有步骤,进而实现图3-4所示虚拟机的数据存储方法的技术效果,具体请参照图3-4相关描述,为简洁描述,在此不作赘述。
本申请实施例还提供了一种非易失性计算机可读存储介质。该非易失性计算机可读存储介质存储有一个或者多个计算机可读指令。其中,非易失性计算机可读存储介质可以包括易失性存储器,例如随机存取存储器;存储器也可以包括非易失性存储器,例如只读存储器、快闪存储器、硬盘或固态硬盘;存储器还可以包括上述种类的存储器的组合。
当非易失性计算机可读存储介质中一个或者多个计算机可读指令可被一个或者多个处理器执行,以实现上述在虚拟机侧执行的虚拟机的数据存储方法。
处理器用于执行存储器中存储的虚拟机的计算机可读指令,以实现以下在虚拟机侧执行的虚拟机的数据存储方法的步骤:
获取虚拟机的启动指令,基于启动指令加载存储设备;访问存储设备中对应的上述至少两个文件的第一存储区域记录的元数据信息,对元数据信息进行校验,得到校验结果;在校验结果正常时,访问上述至少两个文件的第二存储区域记录的数据区域位图信息;基于数据区域位图信息确定上述至少两个文件的数据存储 状态;在上述至少两个文件的数据存储状态均正常时,向上述至少两个文件发送目标数据进行数据存储。
在一个可能的实施方式中,访问上述至少两个文件的第三存储区域的第一标识信息;若第一标识信息一致,则确定上述至少两个文件中存储的数据一致;若第一标识信息不一致,则确定上述至少两个文件中存储的数据不一致,对上述至少两个文件中存储的数据进行数据同步处理。
在一个可能的实施方式中,在虚拟机运行异常时,控制上述至少两个文件的第二存储区域的数据一致以及控制上述至少两个文件的第三存储区域的数据一致;若上述至少两个文件中存在一个文件异常,则在正常文件的第一存储区域记录异常文件信息。
在一个可能的实施方式中,对比上述至少两个文件的第一存储区域记录的元数据信息;若元数据信息一致,则确定校验结果正常;若元数据信息不一致,则确定校验结果异常。
在一个可能的实施方式中,基于上述至少两个文件的第二存储区域记录的数据区域位图信息,生成对应的上述至少两个第二标识信息;对比上述至少两个第二标识信息;若上述至少两个第二标识信息一致,则上述至少两个文件的数据存储状态正常;若上述至少两个第二标识信息不一致,则上述至少两个文件的数据存储状态异常。
在一个可能的实施方式中,在向上述至少两个文件发送目标数据进行数据存储过程中,若存在任一个异常文件,则继续向异常文件发送目标数据;若向异常文件发送目标数据的次数大于或等于次数阈值,且异常文件未成功进行数据存储,则确定异常文件的数据存储路径异常。
在一个可能的实施方式中,在确定异常文件的数据存储路径异常时,向正常文件发送目标数据,以使正常文件继续对目标数据进行数据存储;实时检测异常文件的数据存储状态,若检测到异常文件的数据存储状态正常,则基于正常文件中存储的数据对异常文件进行数据同步处理;在数据同步处理完成时,执行向上述至少两个文件发送目标数据进行数据存储的步骤。
专业人员应该还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为 了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
结合本文中所公开的实施例描述的方法或算法的步骤可以用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。
以上所述的具体实施方式,对本申请的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本申请的具体实施方式而已,并不用于限定本申请的保护范围,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。
Claims (20)
- 一种虚拟机的数据存储方法,其特征在于,包括:获取虚拟机的启动指令,基于所述启动指令加载存储设备;访问所述存储设备中对应的至少两个文件的第一存储区域记录的元数据信息,对所述元数据信息进行校验,得到校验结果;响应于所述校验结果正常,访问所述至少两个文件的第二存储区域记录的数据区域位图信息;基于所述数据区域位图信息确定所述至少两个文件的数据存储状态;及响应于所述至少两个文件的数据存储状态均正常,向所述至少两个文件发送目标数据进行数据存储。
- 根据权利要求1所述的方法,其特征在于,所述方法还包括:访问所述至少两个文件的第三存储区域的第一标识信息;及响应于所述第一标识信息一致,确定所述至少两个文件中存储的数据一致,或,响应于所述第一标识信息不一致,确定所述至少两个文件中存储的数据不一致,对所述至少两个文件中存储的数据进行数据同步处理。
- 根据权利要求1所述的方法,其特征在于,所述方法还包括:响应于所述虚拟机运行异常,控制所述至少两个文件的第二存储区域的数据一致以及控制所述至少两个文件的第三存储区域的数据一致;及响应于所述至少两个文件中存在一个文件异常,在正常文件的第一存储区域记录异常文件信息。
- 根据权利要求1所述的方法,其特征在于,所述访问所述存储设备中对应的至少两个文件的第一存储区域记录的元数据信息,对所述元数据信息进行校验,得到校验结果,包括:对比所述至少两个文件的第一存储区域记录的元数据信息;及响应于所述元数据信息一致,确定所述校验结果正常,或,响应于所述元数据信息不一致,确定所述校验结果异常。
- 根据权利要求4所述的方法,其特征在于,所述基于所述数据区域位图信息确定所述至少两个文件的数据存储状态,包括:基于所述至少两个文件的第二存储区域记录的数据区域位图信息,生成对应 的至少两个第二标识信息;对比所述至少两个第二标识信息;及响应于所述至少两个第二标识信息一致,所述至少两个文件的数据存储状态正常,或,响应于所述至少两个第二标识信息不一致,所述至少两个文件的数据存储状态异常。
- 根据权利要求5所述的方法,其特征在于,所述方法还包括:在向所述至少两个文件发送目标数据进行数据存储过程中,响应于存在任一个异常文件,继续向所述异常文件发送所述目标数据;及响应于向所述异常文件发送目标数据的次数大于或等于次数阈值,且所述异常文件未成功进行数据存储,确定所述异常文件的数据存储路径异常。
- 根据权利要求6所述的方法,其特征在于,所述方法还包括:响应于确定所述异常文件的数据存储路径异常,向正常文件发送所述目标数据,以使所述正常文件继续对所述目标数据进行数据存储;实时检测所述异常文件的数据存储状态,响应于检测到所述异常文件的数据存储状态正常,基于所述正常文件中存储的数据对所述异常文件进行数据同步处理;及响应于所述数据同步处理完成,执行向所述至少两个文件发送目标数据进行数据存储的步骤。
- 根据权利要求2所述的方法,其特征在于,所述至少两个文件中的每一文件包括所述第一存储区域、所述第二存储区域、所述第三存储区域以及第四存储区域;所述第三存储区域存储有每一次更新数据的记录;所述第四存储区域存储有所述虚拟机的真实数据。
- 根据权利要求2所述的方法,其特征在于,所述第三存储区域包括New uuid、Bitmap uuid、Last uuid和History uuid;所述New uuid为当前最新的元数据变更时生成的uuid信息;所述Bitmap uuid为当前的第三数据区域的bitmap生成的uuid信息;所述Last uuid为上一次的元数据变化生成的uuid信息;所述History uuid为前两次的元数据变化生成的uuid信息。
- 根据权利要求4所述的方法,其特征在于,所述至少两个文件互为主备 文件。
- 根据权利要求10所述的方法,其特征在于,所述方法还包括:判断所述两个文件是否为同一组主备文件;所述校验结果正常表征所述两个文件为同一组的主备文件;所述校验结果异常表征所述两个文件不为同一组的主备文件。
- 根据权利要求3所述的方法,其特征在于,在数据存储过程中,所述虚拟机运行异常的情况包括虚拟机以外的设备关机或宕机。
- 根据权利要求9所述的方法,其特征在于,所述方法还包括:响应于存在两个文件的所述New uuid均为空,将所述两个文件加载至虚拟机进程。
- 根据权利要求9所述的方法,其特征在于,所述方法还包括:响应于其中一个文件的New uuid与另一个文件中Last uuid或History uuid一致,将另一个文件的数据全量同步至该文件中。
- 根据权利要求9所述的方法,其特征在于,所述方法还包括:响应于其中一个文件的New uuid与另一个文件中Last uuid或History uuid不一致,手动校验并同步相关数据。
- 根据权利要求7所述的方法,其特征在于,在进行数据同步时,所述方法还包括:根据第三数据区域的第一标识信息判断数据同步方向。
- 根据权利要求7所述的方法,其特征在于,在进行数据同步时,所述方法还包括:控制数据同步量大于正常文件的数据存储量。
- 一种虚拟机的数据存储装置,其特征在于,包括:获取模块,用于获取虚拟机的启动指令,基于所述启动指令加载存储设备;访问模块,用于访问所述存储设备中对应的至少两个文件的第一存储区域记录的元数据信息,对所述元数据信息进行校验,得到校验结果;所述访问模块,还用于在所述校验结果正常时,访问所述至少两个文件的第二存储区域记录的数据区域位图信息;确定模块,用于基于所述数据区域位图信息确定所述至少两个文件的数据存 储状态;及发送模块,用于在所述至少两个文件的数据存储状态均正常时,向所述至少两个文件发送目标数据进行数据存储。
- 一种虚拟机,其特征在于,包括:一个或多个处理器和一个或多个存储器,所述一个或多个处理器用于执行所述一个或多个存储器中存储的虚拟机的计算机可读指令,以实现权利要求1~17中任一项所述的虚拟机的数据存储方法。
- 一种非易失性计算机可读存储介质,其特征在于,所述非易失性计算机可读存储介质存储有计算机可读指令,所述计算机可读指令可被一个或者多个处理器执行,以实现权利要求1~17中任一项所述的虚拟机的数据存储方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210115376.1 | 2022-02-07 | ||
CN202210115376.1A CN114138566B (zh) | 2022-02-07 | 2022-02-07 | 虚拟机的数据存储方法、装置、虚拟机及存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023147738A1 true WO2023147738A1 (zh) | 2023-08-10 |
Family
ID=80381852
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/135166 WO2023147738A1 (zh) | 2022-02-07 | 2022-11-29 | 虚拟机的数据存储方法、装置、虚拟机及存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN114138566B (zh) |
WO (1) | WO2023147738A1 (zh) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114138566B (zh) * | 2022-02-07 | 2022-04-29 | 苏州浪潮智能科技有限公司 | 虚拟机的数据存储方法、装置、虚拟机及存储介质 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102609365A (zh) * | 2012-02-15 | 2012-07-25 | 合一网络技术(北京)有限公司 | 一种虚拟磁盘系统和基于虚拟磁盘系统的文件存储方法 |
US20180349233A1 (en) * | 2017-06-05 | 2018-12-06 | Vmware, Inc. | File synchronization using delta bitmaps |
CN111708603A (zh) * | 2020-05-24 | 2020-09-25 | 苏州浪潮智能科技有限公司 | 一种实时保护Openstack云主机数据的方法和设备 |
CN112711498A (zh) * | 2020-12-29 | 2021-04-27 | 北京浪潮数据技术有限公司 | 一种虚拟机容灾备份方法、装置、设备及可读存储介质 |
CN113190177A (zh) * | 2021-05-12 | 2021-07-30 | 西安雷风电子科技有限公司 | 数据存储方法、终端设备、服务器及系统 |
CN114138566A (zh) * | 2022-02-07 | 2022-03-04 | 苏州浪潮智能科技有限公司 | 虚拟机的数据存储方法、装置、虚拟机及存储介质 |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102693230B (zh) * | 2011-03-23 | 2015-12-09 | 伊姆西公司 | 用于存储区域网络的文件系统 |
US8775774B2 (en) * | 2011-08-26 | 2014-07-08 | Vmware, Inc. | Management system and methods for object storage system |
CN104794028B (zh) * | 2014-01-16 | 2017-08-08 | 中国移动通信集团浙江有限公司 | 一种容灾处理方法、装置、主用数据中心和备用数据中心 |
WO2016191964A1 (zh) * | 2015-05-29 | 2016-12-08 | 华为技术有限公司 | 一种文件系统的管理方法及装置 |
CN109815207A (zh) * | 2018-12-28 | 2019-05-28 | 深圳市安云信息科技有限公司 | 数据存储方法和客户端代理 |
CN111625401B (zh) * | 2020-05-29 | 2023-03-21 | 浪潮电子信息产业股份有限公司 | 基于集群文件系统的数据备份方法、装置及可读存储介质 |
-
2022
- 2022-02-07 CN CN202210115376.1A patent/CN114138566B/zh active Active
- 2022-11-29 WO PCT/CN2022/135166 patent/WO2023147738A1/zh unknown
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102609365A (zh) * | 2012-02-15 | 2012-07-25 | 合一网络技术(北京)有限公司 | 一种虚拟磁盘系统和基于虚拟磁盘系统的文件存储方法 |
US20180349233A1 (en) * | 2017-06-05 | 2018-12-06 | Vmware, Inc. | File synchronization using delta bitmaps |
CN111708603A (zh) * | 2020-05-24 | 2020-09-25 | 苏州浪潮智能科技有限公司 | 一种实时保护Openstack云主机数据的方法和设备 |
CN112711498A (zh) * | 2020-12-29 | 2021-04-27 | 北京浪潮数据技术有限公司 | 一种虚拟机容灾备份方法、装置、设备及可读存储介质 |
CN113190177A (zh) * | 2021-05-12 | 2021-07-30 | 西安雷风电子科技有限公司 | 数据存储方法、终端设备、服务器及系统 |
CN114138566A (zh) * | 2022-02-07 | 2022-03-04 | 苏州浪潮智能科技有限公司 | 虚拟机的数据存储方法、装置、虚拟机及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN114138566B (zh) | 2022-04-29 |
CN114138566A (zh) | 2022-03-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10642694B2 (en) | Monitoring containers in a distributed computing system | |
US9268648B1 (en) | System and method for consistency verification of replicated data in a recovery system | |
RU2449358C1 (ru) | Распределенная файловая система и способ управления согласованностью блоков данных в такой системе | |
TWI545434B (zh) | 非揮發性記憶體系統及使用非揮發性記憶體系統之方法 | |
CN109710317B (zh) | 系统启动方法、装置、电子设备及存储介质 | |
WO2021226905A1 (zh) | 一种数据存储方法、系统及存储介质 | |
WO2019061352A1 (zh) | 数据加载方法及装置 | |
JP5713138B1 (ja) | 仮想計算機システム、プリンタ制御システム、仮想計算機プログラム及びプリンタ制御プログラム | |
WO2023147738A1 (zh) | 虚拟机的数据存储方法、装置、虚拟机及存储介质 | |
CN111538719A (zh) | 数据迁移方法、装置、设备及计算机存储介质 | |
CN110413694A (zh) | 元数据管理方法及相关装置 | |
WO2024113685A1 (zh) | 一种raid阵列的数据恢复方法及相关装置 | |
US10489244B2 (en) | Systems and methods for detecting and correcting memory corruptions in software | |
CN114416665B (zh) | 一种数据一致性检测和修复的方法、装置及介质 | |
US8290992B2 (en) | File management method, file management device, and program | |
US20120158652A1 (en) | System and method for ensuring consistency in raid storage array metadata | |
CN112306753B (zh) | 一种数据修复方法、装置及系统 | |
WO2024113543A1 (zh) | 数据处理方法、系统、装置、非易失性可读存储介质及电子设备 | |
US9785524B2 (en) | Fault tolerant server | |
WO2018076954A1 (zh) | 一种数据存储方法、装置及系统 | |
WO2021082011A1 (zh) | 应用于磁盘阵列系统的数据重构方法、装置及计算设备 | |
CN114840364A (zh) | 对内存中的存储数据进行备份的方法、装置及电子设备 | |
CN111176886A (zh) | 一种数据库模式的切换方法、装置及电子设备 | |
CN113821176B (zh) | 一种数据迁移的处理方法、装置及存储介质 | |
CN117033085B (zh) | kvm虚拟机备份方法、装置、计算机设备及存储介质 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22924665 Country of ref document: EP Kind code of ref document: A1 |