CN108829493A - A kind of virtual machine method for synchronizing time and device - Google Patents
A kind of virtual machine method for synchronizing time and device Download PDFInfo
- Publication number
- CN108829493A CN108829493A CN201810652264.3A CN201810652264A CN108829493A CN 108829493 A CN108829493 A CN 108829493A CN 201810652264 A CN201810652264 A CN 201810652264A CN 108829493 A CN108829493 A CN 108829493A
- Authority
- CN
- China
- Prior art keywords
- time
- virtual machine
- virtual
- physical host
- computer
- 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.)
- Pending
Links
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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F1/00—Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
- G06F1/04—Generating or distributing clock signals or signals derived directly therefrom
- G06F1/12—Synchronisation of different clock signals provided by a plurality of clock generators
Abstract
The invention discloses a kind of virtual machine method for synchronizing time with device includes:Virtual PTP equipment and interface function are added in virtual machine;It is read using virtual PTP equipment by interface function and returns the time of physical host;Use the time synchronization virtual machine of physical host.The present invention can carry out time synchronization for different virtual machine or different types of virtual machine, do not need hardware supported also and can achieve higher timing tracking accuracy.
Description
Technical field
The present invention relates to virtualization fields, more specifically, particularly relating to a kind of virtual machine method for synchronizing time and device.
Background technique
Virtualization technology is the basis of cloud computing technology.It is related as operation system constantly moves on cloud computing platform
The problem of it is also following, wherein for operation system influence it is higher be time consistency.Time consistency is to guarantee own
The premise that business is normally orderly carried out, Time Inconsistency, which will lead to, generates random ordering between multiple operation systems, influences whole system
Normal operation.
Equipment is virtual unit in virtualization technology, does not have hardware RTC (real-time clock) equipment to realize the synchronization of time, this
The time that will lead in virtual machine is normal in virtual machine starting, but with virtual machine long-play, the virtual machine time can be got over
Come slower, the time is caused inconsistent problem occur.At present realize time synchronization method have NTP (Network Time Protocol) and
Two kinds of PTP (precision time protocol), in the case where there is no hardware supported in virtualized environment, the time essence of NTP and PTP synchronization
Degree is consistent, and all in Millisecond, therefore the occasion more demanding in time precision, both modes are unable to satisfy required precision.
The problem for causing time precision lower is synchronized for clock is lacked in virtualized environment in the prior art, at present not yet
There is effective solution scheme.
Summary of the invention
In view of this, the purpose of the embodiment of the present invention is to propose a kind of virtual machine method for synchronizing time and device, it can
Time synchronization is carried out for different virtual machine or different types of virtual machine, when not needing hardware supported and also can achieve higher
Between synchronization accuracy.
Based on above-mentioned purpose, the one side of the embodiment of the present invention provides a kind of virtual machine method for synchronizing time, including with
Lower step:
Virtual PTP equipment and interface function are added in virtual machine;
It is read using virtual PTP equipment by interface function and returns the time of physical host;
Use the time synchronization virtual machine of physical host.
In some embodiments, interface function obtains the time of physical host, and by object by way of shared drive
The time of reason host passes back to virtual machine;Shared drive is the virtual machine address of variable returned by interface function, shared drive
Mode be that virtual machine address of variable is converted into physical host address and assignment by actual situation address conversion function.
In some embodiments, detect interface function can read and return physical host time when, by compiling
It is translated into module and the virtual character equipment of virtual machine is added and add virtual PTP equipment into virtual machine.
In some embodiments, it states to refer to for returning the variable of the time of physical host before calling interface function
Needle;Argument pointer is passed to virtual machine in calling interface function;The object being directed toward after calling interface function according to argument pointer
Manage the time synchronization virtual machine of host.
In some embodiments, virtual PTP equipment is used as clock source, periodically reads and returns physical host
Time.
In some embodiments, the set-up time synchronizing software into virtual machine, time synchronization software will in a manner of PHC
Virtual PTP equipment is used as clock source, repeatedly calculates the difference of the time of physical host and the time of virtual PTP equipment, and takes it most
Big value is precision synchronization time.
The another aspect of the embodiment of the present invention additionally provides a kind of virtual machine time synchronism apparatus, has used the above method.
The another aspect of the embodiment of the present invention additionally provides a kind of computer equipment, including memory, at least one processing
Device and it is stored in the computer program that can be run on the memory and on the processor, described in the processor executes
Above-mentioned method is executed when program.
The another aspect of the embodiment of the present invention additionally provides a kind of computer readable storage medium, described computer-readable
Storage medium is stored with computer program, and the computer program executes above-mentioned method when being executed by processor.
The another aspect of the embodiment of the present invention additionally provides a kind of computer program product, the computer program product
Including the calculation procedure being stored on computer readable storage medium, the calculation procedure includes instruction, when described instruction is counted
When calculation machine executes, the computer is made to execute the above method.
The present invention has following advantageous effects:Virtual machine method for synchronizing time provided in an embodiment of the present invention and dress
It sets, by adding virtual PTP equipment and interface function in virtual machine, being read simultaneously using virtual PTP equipment by interface function
The technical solution of the time of physical host and the time synchronization virtual machine using physical host are returned, it can be for different virtual
Machine or different types of virtual machine carry out time synchronization, do not need hardware supported also and can achieve higher timing tracking accuracy.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is the flow diagram of virtual machine method for synchronizing time provided by the invention;
Fig. 2 is the architecture diagram provided by the invention for implementing virtual machine method for synchronizing time;
Fig. 3 is the flow diagram of a specific embodiment of virtual machine method for synchronizing time provided by the invention;
Fig. 4 is one embodiment of the computer equipment provided by the invention for executing the virtual machine method for synchronizing time
Hardware structural diagram.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with specific embodiment, and reference
The embodiment of the present invention is further described in attached drawing.
It should be noted that all statements for using " first " and " second " are for differentiation two in the embodiment of the present invention
The non-equal entity of a same names or non-equal parameter, it is seen that " first " " second " only for the convenience of statement, does not answer
It is interpreted as the restriction to the embodiment of the present invention, subsequent embodiment no longer illustrates this one by one.
Based on above-mentioned purpose, the first aspect of the embodiment of the present invention, propose one kind can for different virtual machine or
Different types of virtual machine carries out one embodiment of the method for time synchronization.Shown in fig. 1 is provided by the invention virtual
The flow diagram of the embodiment of machine method for synchronizing time.
The virtual machine method for synchronizing time, includes the following steps:
Step S101 adds virtual PTP equipment and interface function in virtual machine;
Step S103 is read by interface function using virtual PTP equipment and returns the time of physical host;
Step S105 uses the time synchronization virtual machine of physical host.
As shown in Fig. 2, the Hypervisor layer of virtualization is transformed in the embodiment of the present invention first, called interface letter is added
Number HYPERCALL realizes the calling system time and is returned in HYPERCALL function.Then, it is added in virtual machine virtual
PTP equipment, the system that read access time is realized in this PTP equipment calls function (i.e. calling HYPERCALL function), thus in void
The time of physical host is got in quasi- machine.Then the time of physical host is covered into virtual machine.
In some embodiments, interface function obtains the time of physical host, and by object by way of shared drive
The time of reason host passes back to virtual machine;Shared drive is the virtual machine address of variable returned by interface function, shared drive
Mode be that virtual machine address of variable is converted into physical host address and assignment by actual situation address conversion function.
The embodiment of the present invention adds called interface function in the virtualization part of KVM (virtual machine based on Kernel)
HYPERCALL.HYPERCALL obtains the system time in kernel by get_time_of_day function, and passes through shared drive
Mode by the time of physical host back in virtual machine.Shared drive is to be passed to when entering KVM by HYPERCALL
Virtual machine address of variable.Virtual machine address is converted into the address of physical machine by actual situation address conversion function, and gives this change
Address assignment is measured, to realize that address is shared.
In some embodiments, detect interface function can read and return physical host time when, by compiling
It is translated into module and the virtual character equipment of virtual machine is added and add virtual PTP equipment into virtual machine.
The embodiment of the present invention adds a virtual character equipment in virtual machine kernel, and is compiled into module, by it with mould
The mode of block is added in kernel.Character device is called the detection of HYPERCALL in initialization, if HYPERCALL without
Method normally returns, then directly exits, and does not regenerate virtual PTP equipment;If HYPERCALL is normally returned, virtual PTP is generated
Equipment.
In some embodiments, it states to refer to for returning the variable of the time of physical host before calling interface function
Needle;Argument pointer is passed to virtual machine in calling interface function;The object being directed toward after calling interface function according to argument pointer
Manage the time synchronization virtual machine of host.
Ioctl of the embodiment of the present invention based on virtual PTP equipment realization system calling be (management equipment I/O channel
Function).Ioctl reads the function of time of PTP equipment, and the sound before calling HYPERCALL by calling HYPERCALL
A bright argument pointer, this argument pointer is primarily to return the time of physical machine, when calling HYPERCALL by this variable
Pointer is incoming, saves the time of physical host in this variable after the completion of calling HYPERCALL, and updated virtually with this time
The time of machine, to realize the time of virtual machine real-time synchronization physical host.
In some embodiments, virtual PTP equipment is used as clock source, periodically reads and returns physical host
Time.
The embodiment of the present invention is the real-time synchronization for guaranteeing the virtual machine time, is needed using virtual PTP equipment as core clock
Source (i.e. as the clock source of timekeeper), timekeeper can be read according to fixed frequency the time of virtual PTP equipment with
The time of entire virtual machine is synchronized, thus the periodic synchronous of deadline.
In some embodiments, the set-up time synchronizing software into virtual machine, with PHC, (PHP's opens time synchronization software
Source editing machine) mode virtual PTP equipment is used as clock source, repeatedly calculate physical host time and virtual PTP equipment
The difference of time, and taking its maximum value is precision synchronization time.
The embodiment of the present invention is in order to facilitate read access time precision and realizes time synchronization, needs to pacify in virtual machine user space
Virtual PTP (is registered timekeeper as clock source in a manner of PHC by ETL estimated time of loading synchronizing software chrony in kernel
Clock source).This mode only can generate error when reading PTP equipment, so its time precision=virtual PTP equipment
When m- system time.Precision maximum value is obtained after multiple statistics, i.e., precision synchronization time above-mentioned.
From above-described embodiment as can be seen that virtual machine method for synchronizing time provided in an embodiment of the present invention, by virtual
Virtual PTP equipment and interface function are added in machine, are read using virtual PTP equipment by interface function and are returned physical host
The technical solution of time and the time synchronization virtual machine using physical host, can be directed to different virtual machine or different types of
Virtual machine carries out time synchronization, does not need hardware supported also and can achieve higher timing tracking accuracy.
Based on above-mentioned purpose, the first aspect of the embodiment of the present invention, propose one kind can for different virtual machine or
Different types of virtual machine carries out second embodiment of the method for time synchronization.Fig. 3 shows provided by the invention virtual
The flow diagram of the embodiment of machine method for synchronizing time.
As shown in figure 3, called interface function HYPERCALL is added in the virtualization part in KVM.HYPERCALL is logical
Cross get_time_of_day function obtain kernel in system time, and by way of shared drive by physical host when
Between back in virtual machine.Shared drive is to pass through the incoming virtual machine address of variable of HYPERCALL when entering KVM.Pass through
Virtual machine address is converted into the address of physical machine by actual situation address conversion function, and gives this address of variable assignment, to realize ground
Location is shared.
A virtual character equipment is added in virtual machine kernel, and is compiled into module, it is added in a manner of module
In kernel.Character device is called the detection of HYPERCALL in initialization, if HYPERCALL can not be returned normally,
It directly exits, does not regenerate virtual PTP equipment;If HYPERCALL is normally returned, PTP equipment is generated.
The ioctl (function of management equipment I/O channel) that system is called is realized based on virtual PTP equipment.ioctl
The function of time of PTP equipment is read by calling HYPERCALL, and states a variable before calling HYPERCALL
Pointer, this argument pointer primarily to passback physical machine time, this argument pointer is passed to when calling HYPERCALL,
The time of physical host is saved in this variable after the completion of calling HYPERCALL, and updates the time of virtual machine with this time,
To realize the time of virtual machine real-time synchronization physical host.
For the real-time synchronization for guaranteeing the virtual machine time, need using virtual PTP equipment as (the i.e. conduct of core clock source
The clock source of timekeeper), timekeeper can read the time of virtual PTP equipment according to fixed frequency to synchronize entire void
The time of quasi- machine, thus the periodic synchronous of deadline.
It in order to facilitate read access time precision and realizes time synchronization, needs the set-up time to synchronize in virtual machine user space soft
Part chrony, by virtual PTP as clock source the clock source of timekeeper (i.e. in kernel register) in a manner of PHC.This
Kind mode only can generate error when reading PTP equipment, so when its time precision=virtual PTP equipment when m- system
Between.Precision maximum value is obtained after multiple statistics, i.e., precision synchronization time above-mentioned.
It is important to note that each step in each embodiment of above-mentioned virtual machine method for synchronizing time can be with
It intersects, replace, increase, delete, therefore, these reasonable permutation and combination transformation are also answered in virtual machine method for synchronizing time
When belonging to the scope of protection of the present invention, and protection scope of the present invention should not be confined on the embodiment.
Based on above-mentioned purpose, the second aspect of the embodiment of the present invention, propose one kind can for different virtual machine or
Different types of virtual machine carries out one embodiment of the device of time synchronization.The virtual machine time synchronism apparatus uses
Above-mentioned virtual machine method for synchronizing time.
From above-described embodiment as can be seen that virtual machine time synchronism apparatus provided in an embodiment of the present invention, by virtual
Virtual PTP equipment and interface function are added in machine, are read using virtual PTP equipment by interface function and are returned physical host
The technical solution of time and the time synchronization virtual machine using physical host, can be directed to different virtual machine or different types of
Virtual machine carries out time synchronization, does not need hardware supported also and can achieve higher timing tracking accuracy.
It is important to note that the embodiment of above-mentioned virtual machine time synchronism apparatus is same using the virtual machine time
The embodiment of one step process illustrates the course of work of each module, and those skilled in the art can be it is readily conceivable that by these
Module application is into the other embodiments of the virtual machine method for synchronizing time.Certainly, due to the virtual machine time synchronization side
Each step in method embodiment can be intersected, replaces, increases, be deleted, therefore, these reasonable permutation and combination transformation
Should also be as belonging to the scope of protection of the present invention in the virtual machine time synchronism apparatus, and should not be by protection model of the invention
It encloses and is confined on the embodiment.
Based on above-mentioned purpose, it is same to propose a kind of execution virtual machine time for the third aspect of the embodiment of the present invention
One embodiment of the computer equipment of one step process.
The computer equipment for executing the virtual machine method for synchronizing time include memory, at least one processor with
And the computer program that can be run on a memory and on a processor is stored, processor executes above-mentioned any one when executing program
Kind method.
As shown in figure 4, for one of the computer equipment provided by the invention for executing the virtual machine method for synchronizing time
The hardware structural diagram of embodiment.
It include a processor 401 and one in the computer equipment by taking computer equipment as shown in Figure 4 as an example
Memory 402, and can also include:Input unit 403 and output device 404.
Processor 401, memory 402, input unit 403 and output device 404 can pass through bus or other modes
It connects, in Fig. 4 for being connected by bus.
Memory 402 is used as a kind of non-volatile computer readable storage medium storing program for executing, can be used for storing non-volatile software journey
Sequence, non-volatile computer executable program and module, such as the virtual machine method for synchronizing time in the embodiment of the present application
Corresponding program instruction/module.Processor 401 is by running the non-volatile software program being stored in memory 402, instruction
And module, thereby executing the various function application and data processing of server, i.e., realization above method embodiment is virtual
Machine method for synchronizing time.
Memory 402 may include storing program area and storage data area, wherein storing program area can store operation system
Application program required for system, at least one function;Storage data area can store the use according to virtual machine time synchronism apparatus
The data etc. created.In addition, memory 402 may include high-speed random access memory, it can also include non-volatile deposit
Reservoir, for example, at least a disk memory, flush memory device or other non-volatile solid state memory parts.In some implementations
In example, optional memory 402 includes the memory remotely located relative to processor 401, these remote memories can pass through
It is connected to the network to local module.The example of above-mentioned network includes but is not limited to internet, intranet, local area network, moves and lead to
Letter net and combinations thereof.
Input unit 403 can receive the number or character information of input, and generate and virtual machine time synchronism apparatus
User setting and the related key signals input of function control.Output device 404 may include that display screen etc. shows equipment.
Corresponding program instruction/the module of one or more of virtual machine method for synchronizing time is stored in the memory
In 402, when being executed by the processor 401, the virtual machine method for synchronizing time in above-mentioned any means embodiment is executed.
Any one embodiment of the computer equipment for executing the virtual machine method for synchronizing time, can achieve with
The identical or similar effect of corresponding aforementioned any means embodiment.
Based on above-mentioned purpose, the 4th aspect of the embodiment of the present invention proposes a kind of computer readable storage medium, institute
Stating computer-readable recording medium storage has computer executable instructions, which can be performed above-mentioned any side
The virtual machine time synchronization in virtual machine method for synchronizing time and the above-mentioned any device/system embodiment of realization in method embodiment
Device/system.The embodiment of the computer readable storage medium can achieve corresponding aforementioned any means and dress
Set/identical or similar the effect of system embodiment.
Based on above-mentioned purpose, the 5th aspect of the embodiment of the present invention proposes a kind of computer program product, the calculating
Machine program product includes the calculation procedure being stored on computer readable storage medium, which includes instruction, when this
When instruction is computer-executed, the computer is made to execute virtual machine method for synchronizing time and reality in above-mentioned any means embodiment
Virtual machine time synchronism apparatus/system in existing above-mentioned any device/system embodiment.The implementation of the computer program product
Example, can achieve the corresponding aforementioned any means effect identical or similar with device/system embodiment.
Finally, it should be noted that those of ordinary skill in the art will appreciate that realizing the whole in above-described embodiment method
Or part process, related hardware can be instructed to complete by computer program, the program can be stored in a computer
In read/write memory medium, the program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, described
Storage medium can be magnetic disk, CD, read-only memory (Read-Only Memory, ROM) or random access memory
(Random Access Memory, RAM) etc..The embodiment of the computer program can achieve corresponding aforementioned
The identical or similar effect of embodiment of the method for anticipating.
In addition, typically, it can be various electric terminal equipments, example that the embodiment of the present invention, which discloses described device, equipment etc.,
Such as mobile phone, personal digital assistant (PDA), tablet computer (PAD), smart television, are also possible to large-scale terminal device, such as service
Device etc., therefore protection scope disclosed by the embodiments of the present invention should not limit as certain certain types of device, equipment.The present invention is real
Apply example disclose the client can be applied to the combining form of electronic hardware, computer software or both it is above-mentioned any
In a kind of electric terminal equipment.
In addition, disclosed method is also implemented as the computer program executed by CPU according to embodiments of the present invention, it should
Computer program may be stored in a computer readable storage medium.When the computer program is executed by CPU, the present invention is executed
The above-mentioned function of being limited in method disclosed in embodiment.
In addition, above method step and system unit also can use controller and for storing so that controller is real
The computer readable storage medium of the computer program of existing above-mentioned steps or Elementary Function is realized.
In addition, it should be appreciated that computer readable storage medium (for example, memory) as described herein can be it is volatile
Property memory or nonvolatile memory, or may include both volatile memory and nonvolatile memory.As example
And not restrictive, nonvolatile memory may include read-only memory (ROM), programming ROM (PROM), electrically programmable to son
ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory.Volatile memory may include arbitrary access
Memory (RAM), the RAM can serve as external cache.As an example and not restrictive, RAM can be with more
Kind form obtains, such as synchronous random access memory (DRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate SDRAM
(DDR SDRAM), enhancing SDRAM (ESDRAM), synchronization link DRAM (SLDRAM) and directly Rambus RAM (DRRAM).
The storage equipment of disclosed aspect is intended to the memory of including but not limited to these and other suitable type.
Those skilled in the art will also understand is that, various illustrative logical blocks, mould in conjunction with described in disclosure herein
Block, circuit and algorithm steps may be implemented as the combination of electronic hardware, computer software or both.It is hard in order to clearly demonstrate
This interchangeability of part and software, with regard to various exemplary components, square, module, circuit and step function to its into
General description is gone.This function is implemented as software and is also implemented as hardware depending on concrete application and application
To the design constraint of whole system.Those skilled in the art can realize described in various ways for every kind of concrete application
Function, but this realization decision should not be interpreted as causing a departure from range disclosed by the embodiments of the present invention.
Various illustrative logical blocks, module and circuit, which can use, in conjunction with described in disclosure herein is designed to
The following component of function described here is executed to realize or execute:General processor, digital signal processor (DSP), dedicated collection
At circuit (ASIC), field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, divide
Any combination of vertical hardware component or these components.General processor can be microprocessor, but alternatively, processing
Device can be any conventional processors, controller, microcontroller or state machine.Processor also may be implemented as calculating equipment
Combination, for example, the combination of DSP and microprocessor, multi-microprocessor, one or more microprocessors combination DSP and/or any
Other this configurations.
The step of method in conjunction with described in disclosure herein or algorithm, can be directly contained in hardware, be held by processor
In capable software module or in combination of the two.Software module may reside within RAM memory, flash memory, ROM storage
Device, eprom memory, eeprom memory, register, hard disk, removable disk, CD-ROM or known in the art it is any its
In the storage medium of its form.Illustrative storage medium is coupled to processor, enables a processor to from the storage medium
Information is written to the storage medium in middle reading information.In an alternative, the storage medium can be with processor collection
At together.Pocessor and storage media may reside in ASIC.ASIC may reside in user terminal.It is replaced at one
In scheme, it is resident in the user terminal that pocessor and storage media can be used as discrete assembly.
In one or more exemplary designs, the function can be real in hardware, software, firmware or any combination thereof
It is existing.If realized in software, can be stored in using the function as one or more instruction or code computer-readable
It is transmitted on medium or by computer-readable medium.Computer-readable medium includes computer storage media and communication media,
The communication media includes any medium for helping for computer program to be transmitted to another position from a position.Storage medium
It can be any usable medium that can be accessed by a general purpose or special purpose computer.As an example and not restrictive, the computer
Readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disc memory apparatus, disk storage equipment or other magnetic
Property storage equipment, or can be used for carry or storage form be instruct or data structure required program code and can
Any other medium accessed by general or specialized computer or general or specialized processor.In addition, any connection is ok
It is properly termed as computer-readable medium.For example, if using coaxial cable, optical fiber cable, twisted pair, digital subscriber line
(DSL) or such as wireless technology of infrared ray, radio and microwave to send software from website, server or other remote sources,
Then above-mentioned coaxial cable, optical fiber cable, twisted pair, DSL or such as wireless technology of infrared ray, radio and microwave are included in
The definition of medium.As used herein, disk and CD include compact disk (CD), laser disk, CD, digital versatile disc
(DVD), floppy disk, Blu-ray disc, wherein disk usually magnetically reproduce data, and CD using laser optics reproduce data.On
The combination for stating content should also be as being included in the range of computer-readable medium.
It is exemplary embodiment disclosed by the invention above, it should be noted that in the sheet limited without departing substantially from claim
Under the premise of inventive embodiments scope of disclosure, it may be many modifications and modify.According to open embodiment described herein
The function of claim to a method, step and/or movement be not required to the execution of any particular order.In addition, although the present invention is implemented
Element disclosed in example can be described or be required in the form of individual, but be unless explicitly limited odd number, it is understood that be multiple.
It should be understood that it is used in the present context, unless the context clearly supports exceptions, singular " one
It is a " (" a ", " an ", " the ") be intended to also include plural form.It is to be further understood that "and/or" used herein is
Refer to any and all possible combinations including one or more than one project listed in association.
It is for illustration only that the embodiments of the present invention disclose embodiment sequence number, does not represent the advantages or disadvantages of the embodiments.
Those of ordinary skill in the art will appreciate that realizing that all or part of the steps of above-described embodiment can pass through hardware
It completes, relevant hardware can also be instructed to complete by program, the program can store in a kind of computer-readable
In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
Those of ordinary skills in the art should understand that:The discussion of any of the above embodiment is exemplary only, not
It is intended to imply that range disclosed by the embodiments of the present invention (including claim) is limited to these examples;In the think of of the embodiment of the present invention
Under road, it can also be combined between the technical characteristic in above embodiments or different embodiments, and exist as described above
Many other variations of the different aspect of the embodiment of the present invention, for simplicity, they are not provided in details.Therefore, all at this
Within the spirit and principle of inventive embodiments, any omission, modification, equivalent replacement, improvement for being made etc. should be included in this hair
Within the protection scope of bright embodiment.
Claims (10)
1. a kind of virtual machine method for synchronizing time, which is characterized in that include the following steps:
Virtual PTP equipment and interface function are added in virtual machine;
It is read using the virtual PTP equipment by the interface function and returns the time of physical host;
Virtual machine described in time synchronization using the physical host.
2. the method according to claim 1, wherein the interface function obtains the time of the physical host,
And the time of the physical host is passed back into the virtual machine by way of shared drive;The shared drive is to pass through institute
The virtual machine address of variable of interface function passback is stated, the mode of the shared drive is by actual situation address conversion function by the void
Quasi- machine address of variable is converted into physical host address and assignment.
3. the method according to claim 1, wherein detecting that the interface function can read and return institute
When stating the time of physical host, added from being compiled into module and the virtual character equipment of the virtual machine being added into the virtual machine
Add the virtual PTP equipment.
4. the method according to claim 1, wherein statement is described for returning before calling the interface function
The argument pointer of the time of physical host;The argument pointer is passed to the virtual machine when calling the interface function;?
Call virtual machine described in the time synchronization for the physical host being directed toward after the interface function according to the argument pointer.
5. the method according to claim 1, wherein the virtual PTP equipment is used as clock source, periodically
Read and return the time of the physical host.
6. the method according to claim 1, wherein the set-up time synchronizing software into the virtual machine, described
The virtual PTP equipment is used as clock source in a manner of PHC by time synchronization software, repeatedly calculates the time of the physical host
And the difference of the time of the virtual PTP equipment, and taking its maximum value is precision synchronization time.
7. a kind of virtual machine time synchronism apparatus, which is characterized in that use method as claimed in any one of claims 1 to 6.
8. a kind of computer equipment, including memory, at least one processor and it is stored on the memory and can be in institute
State the computer program run on processor, which is characterized in that the processor executes such as claim when executing described program
Method described in 1-6 any one.
9. a kind of computer readable storage medium, the computer-readable recording medium storage has computer program, and feature exists
In perform claim requires method described in 1-6 any one when the computer program is executed by processor.
10. a kind of computer program product, which is characterized in that the computer program product includes being stored in computer-readable deposit
Calculation procedure on storage media, the calculation procedure include instruction, when described instruction is computer-executed, make the computer
Perform claim requires method described in 1-6 any one.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810652264.3A CN108829493A (en) | 2018-06-22 | 2018-06-22 | A kind of virtual machine method for synchronizing time and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810652264.3A CN108829493A (en) | 2018-06-22 | 2018-06-22 | A kind of virtual machine method for synchronizing time and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108829493A true CN108829493A (en) | 2018-11-16 |
Family
ID=64137706
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810652264.3A Pending CN108829493A (en) | 2018-06-22 | 2018-06-22 | A kind of virtual machine method for synchronizing time and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108829493A (en) |
Cited By (21)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110377106A (en) * | 2019-06-21 | 2019-10-25 | 湖南麒麟信安科技有限公司 | System card virtual method, system and medium when a kind of |
CN111404628A (en) * | 2019-06-05 | 2020-07-10 | 杭州海康威视系统技术有限公司 | Time synchronization method and device |
CN111901417A (en) * | 2020-07-28 | 2020-11-06 | 山东超越数控电子股份有限公司 | Time synchronization system based on vehicle-mounted edge cloud environment and implementation method |
CN112181049A (en) * | 2020-08-27 | 2021-01-05 | 济南浪潮数据技术有限公司 | Cluster time synchronization method, device, system, equipment and readable storage medium |
CN112904932A (en) * | 2021-05-08 | 2021-06-04 | 鹏城实验室 | Clock synchronization method, board card, computer storage medium and terminal equipment |
CN113489563A (en) * | 2021-07-02 | 2021-10-08 | 广州市品高软件股份有限公司 | Clock synchronization method of virtual machine and cloud platform |
CN113626142A (en) * | 2021-07-14 | 2021-11-09 | 麒麟软件有限公司 | Virtual time system card hot migration method |
CN113672031A (en) * | 2021-09-07 | 2021-11-19 | 西安超越申泰信息科技有限公司 | Time synchronization method and device, computer equipment and storage medium |
CN114003091A (en) * | 2021-10-29 | 2022-02-01 | 深圳市科思科技股份有限公司 | Time synchronization method, device, equipment and storage medium |
US11283454B2 (en) | 2018-11-26 | 2022-03-22 | Mellanox Technologies, Ltd. | Synthesized clock synchronization between network devices |
CN114499729A (en) * | 2021-12-23 | 2022-05-13 | 天翼云科技有限公司 | Virtual machine time synchronization method, equipment and storage medium |
US11483127B2 (en) * | 2018-11-18 | 2022-10-25 | Mellanox Technologies, Ltd. | Clock synchronization |
US11543852B2 (en) | 2019-11-07 | 2023-01-03 | Mellanox Technologies, Ltd. | Multihost clock synchronization |
US11552871B2 (en) | 2020-06-14 | 2023-01-10 | Mellanox Technologies, Ltd. | Receive-side timestamp accuracy |
US11588609B2 (en) | 2021-01-14 | 2023-02-21 | Mellanox Technologies, Ltd. | Hardware clock with built-in accuracy check |
US11606427B2 (en) | 2020-12-14 | 2023-03-14 | Mellanox Technologies, Ltd. | Software-controlled clock synchronization of network devices |
US11706014B1 (en) | 2022-01-20 | 2023-07-18 | Mellanox Technologies, Ltd. | Clock synchronization loop |
US11748141B2 (en) | 2020-10-30 | 2023-09-05 | Red Hat, Inc. | Providing virtual devices direct access to clock times in memory locations managed by a hypervisor |
US11835999B2 (en) | 2022-01-18 | 2023-12-05 | Mellanox Technologies, Ltd. | Controller which adjusts clock frequency based on received symbol rate |
US11907754B2 (en) | 2021-12-14 | 2024-02-20 | Mellanox Technologies, Ltd. | System to trigger time-dependent action |
US11917045B2 (en) | 2022-07-24 | 2024-02-27 | Mellanox Technologies, Ltd. | Scalable synchronization of network devices |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102541651A (en) * | 2011-12-12 | 2012-07-04 | 华中科技大学 | Real-time scheduling system of embedded virtual machine (VM) |
CN103957233A (en) * | 2014-03-26 | 2014-07-30 | 哈尔滨工业大学 | Real-time communication platform based on processor nucleus dividing and virtual machine |
US20160112182A1 (en) * | 2014-10-15 | 2016-04-21 | Anue Systems, Inc. | Network Packet Timing Synchronization For Virtual Machine Host Systems |
US9459652B1 (en) * | 2010-10-22 | 2016-10-04 | Vmware, Inc. | Virtual reference clock for virtual machines |
-
2018
- 2018-06-22 CN CN201810652264.3A patent/CN108829493A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9459652B1 (en) * | 2010-10-22 | 2016-10-04 | Vmware, Inc. | Virtual reference clock for virtual machines |
CN102541651A (en) * | 2011-12-12 | 2012-07-04 | 华中科技大学 | Real-time scheduling system of embedded virtual machine (VM) |
CN103957233A (en) * | 2014-03-26 | 2014-07-30 | 哈尔滨工业大学 | Real-time communication platform based on processor nucleus dividing and virtual machine |
US20160112182A1 (en) * | 2014-10-15 | 2016-04-21 | Anue Systems, Inc. | Network Packet Timing Synchronization For Virtual Machine Host Systems |
Non-Patent Citations (3)
Title |
---|
看雪学院: "Xen hypervisor的跨虚拟机代码执行", 《HTTPS://ZHUANLAN.ZHIHU.COM/P/26874310》 * |
興趣使然的小胃: "【技术分享】如何攻击Xen虚拟机管理程序", 《HTTPS://WWW.ANQUANKE.COM/POST/ID/86051?FROM=TIMELINE》 * |
黄振林: "基于IEEE1588的虚拟集群多任务同步技术研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Cited By (29)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11483127B2 (en) * | 2018-11-18 | 2022-10-25 | Mellanox Technologies, Ltd. | Clock synchronization |
US11637557B2 (en) | 2018-11-26 | 2023-04-25 | Mellanox Technologies, Ltd. | Synthesized clock synchronization between network devices |
US11283454B2 (en) | 2018-11-26 | 2022-03-22 | Mellanox Technologies, Ltd. | Synthesized clock synchronization between network devices |
CN111404628A (en) * | 2019-06-05 | 2020-07-10 | 杭州海康威视系统技术有限公司 | Time synchronization method and device |
CN111404628B (en) * | 2019-06-05 | 2022-03-29 | 杭州海康威视系统技术有限公司 | Time synchronization method and device |
CN110377106A (en) * | 2019-06-21 | 2019-10-25 | 湖南麒麟信安科技有限公司 | System card virtual method, system and medium when a kind of |
US11543852B2 (en) | 2019-11-07 | 2023-01-03 | Mellanox Technologies, Ltd. | Multihost clock synchronization |
US11552871B2 (en) | 2020-06-14 | 2023-01-10 | Mellanox Technologies, Ltd. | Receive-side timestamp accuracy |
CN111901417B (en) * | 2020-07-28 | 2022-08-23 | 超越科技股份有限公司 | Time synchronization system based on vehicle-mounted edge cloud environment and implementation method |
CN111901417A (en) * | 2020-07-28 | 2020-11-06 | 山东超越数控电子股份有限公司 | Time synchronization system based on vehicle-mounted edge cloud environment and implementation method |
CN112181049A (en) * | 2020-08-27 | 2021-01-05 | 济南浪潮数据技术有限公司 | Cluster time synchronization method, device, system, equipment and readable storage medium |
CN112181049B (en) * | 2020-08-27 | 2023-02-24 | 济南浪潮数据技术有限公司 | Cluster time synchronization method, device, system, equipment and readable storage medium |
US11748141B2 (en) | 2020-10-30 | 2023-09-05 | Red Hat, Inc. | Providing virtual devices direct access to clock times in memory locations managed by a hypervisor |
US11606427B2 (en) | 2020-12-14 | 2023-03-14 | Mellanox Technologies, Ltd. | Software-controlled clock synchronization of network devices |
US11588609B2 (en) | 2021-01-14 | 2023-02-21 | Mellanox Technologies, Ltd. | Hardware clock with built-in accuracy check |
CN112904932A (en) * | 2021-05-08 | 2021-06-04 | 鹏城实验室 | Clock synchronization method, board card, computer storage medium and terminal equipment |
CN113489563A (en) * | 2021-07-02 | 2021-10-08 | 广州市品高软件股份有限公司 | Clock synchronization method of virtual machine and cloud platform |
CN113489563B (en) * | 2021-07-02 | 2023-08-15 | 广州市品高软件股份有限公司 | Clock synchronization method of virtual machine and cloud platform |
CN113626142B (en) * | 2021-07-14 | 2024-04-05 | 麒麟软件有限公司 | Virtual time system card thermal migration method |
CN113626142A (en) * | 2021-07-14 | 2021-11-09 | 麒麟软件有限公司 | Virtual time system card hot migration method |
CN113672031A (en) * | 2021-09-07 | 2021-11-19 | 西安超越申泰信息科技有限公司 | Time synchronization method and device, computer equipment and storage medium |
CN114003091B (en) * | 2021-10-29 | 2024-01-30 | 深圳市科思科技股份有限公司 | Time synchronization method, device, equipment and storage medium |
CN114003091A (en) * | 2021-10-29 | 2022-02-01 | 深圳市科思科技股份有限公司 | Time synchronization method, device, equipment and storage medium |
US11907754B2 (en) | 2021-12-14 | 2024-02-20 | Mellanox Technologies, Ltd. | System to trigger time-dependent action |
CN114499729B (en) * | 2021-12-23 | 2023-06-23 | 天翼云科技有限公司 | Virtual machine time synchronization method, device and storage medium |
CN114499729A (en) * | 2021-12-23 | 2022-05-13 | 天翼云科技有限公司 | Virtual machine time synchronization method, equipment and storage medium |
US11835999B2 (en) | 2022-01-18 | 2023-12-05 | Mellanox Technologies, Ltd. | Controller which adjusts clock frequency based on received symbol rate |
US11706014B1 (en) | 2022-01-20 | 2023-07-18 | Mellanox Technologies, Ltd. | Clock synchronization loop |
US11917045B2 (en) | 2022-07-24 | 2024-02-27 | Mellanox Technologies, Ltd. | Scalable synchronization of network devices |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108829493A (en) | A kind of virtual machine method for synchronizing time and device | |
US10235273B2 (en) | Indexing a trace by insertion of key frames for replay responsiveness | |
US9959194B1 (en) | Indexing a trace by insertion of memory snapshots for replay responsiveness | |
US10296442B2 (en) | Distributed time-travel trace recording and replay | |
US20170031804A1 (en) | Enhanced service validation | |
CN107423387A (en) | The method and apparatus of table is divided in a kind of point storehouse based on middleware | |
CN110427359A (en) | A kind of diagram data treating method and apparatus | |
CN110413408A (en) | A kind of video memory control method, equipment and the storage medium of deep learning frame | |
CN108881227B (en) | Operation control method and device of remote whiteboard system and remote whiteboard system | |
CN110046175B (en) | Cache updating and data returning method and device | |
CN110442307A (en) | Binding method, equipment and the storage medium of disk in a kind of linux system | |
CN107330028A (en) | Expansion application methods and system of a kind of Apache NiFi in terms of source data input database | |
CN110502215A (en) | A kind of construction method, equipment and the storage medium of micro services program | |
CN107589986A (en) | A kind of universal process method and device of data processing time-out | |
WO2023213263A1 (en) | Program compiling method, program starting method, and device and storage medium | |
CN111177026A (en) | Method and device for modifying variable memory layout and computer equipment | |
CN110413376A (en) | A kind of method, equipment and the storage medium of Virtual Machine Manager USB device | |
CN110442601A (en) | A kind of method and apparatus that Openstack mirror image data accelerates parallel | |
CN104408178A (en) | Device and method for WEB control loading | |
US8769498B2 (en) | Warning of register and storage area assignment errors | |
CN108399076A (en) | A kind of firmware update and device based on UEFI | |
CN107911427A (en) | A kind of cluster control method and device based on ICE middlewares | |
CN108196934A (en) | The time set method, apparatus and virtual equipment of a kind of timer | |
US10466974B2 (en) | Independent expression animations | |
CN113127438B (en) | Method, apparatus, server and medium for storing data |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20181116 |