The content of the invention
To solve the above problems, the invention provides a kind of method for realizing container compatible mainframe fictitious host computer image file
And device.
In a first aspect, the invention provides a kind of method for realizing container compatible mainframe fictitious host computer image file, the party
Method includes:
Fictitious host computer image file is mapped as virtual hard disk using the first operating instruction;
The All Files in virtual hard disk is mapped in the first file of host using the second operating instruction, wherein
First file is any file of host;
The operating system file of fictitious host computer is obtained from the first file;
Start container main frame using the operating system file of fictitious host computer.
The beneficial effects of the invention are as follows:Fictitious host computer image file is mapped as virtual hard disk, then by virtual hard disk
All Files map in the first file of host.Root using the first file as container main frame, from first
The operating system file of fictitious host computer is obtained in file, and using the operating system file of fictitious host computer, starts container main frame.
And in this process, container main frame can compatible fictitious host computer image file, and can be performed after starting corresponding
Action.
Further, the All Files in virtual hard disk is mapped to the first file of host using the second operating instruction
Afterwards, method also includes:
By the second file of business datum File Mapping corresponding to container main frame to host;
The file in file and the second file in the first file, create union file system;
The operating system file of fictitious host computer is obtained from union file system;
According to the operating system file of fictitious host computer, start container main frame, wherein the second file is except the in host
Any file outside one file.
It is using the above-mentioned further beneficial effect of scheme:Using the second operating instruction by virtual hard disk it is all that
After File Mapping to the first file of host, the business datum of container main frame can also be mapped as to the second of host
File.Also, the file in the file and the second file in the first file, create union file system.Enter one
Step obtains the operating system file of fictitious host computer from union file system, and is opened using the operating system file of fictitious host computer
Visibly moved device main frame.And container main frame uses union file system, it is ensured that the performance of container main frame is more preferable.
Further, union file system includes upper strata store path and lower floor's store path, wherein, lower floor's store path is used
In the file for storing the first file, upper strata store path is used for the file for storing the second file.
It is using the above-mentioned further beneficial effect of scheme:It is above-mentioned further in brief description container main frame make
With union file system, the performance of container main frame can be made more preferable.And be then to describe in detail here, union file system includes upper
Lower two layers of store path, upper strata are used for the data file for storing the second file, that is to say data file corresponding to container main frame;
And it is the image file of fictitious host computer that lower floor, which then stores,.Upper strata can be used for read/write file, and lower floor is then served only for reading file.
It is intended that the different performance for being adapted to different vessels main frame is read or write on upper strata.And lower floor is then read-only, it is therefore an objective to be
Ensure that the image file of fictitious host computer is not changed.
Further, when starting container main frame, method also includes:
Union file system is mapped as to the root folder of container main frame, root file is shared with the software in Bedpan main frame
File in folder.
It is using the above-mentioned further beneficial effect of scheme:, can be by the first file in container host process is started
Or second file, the root folder of file that fictitious host computer image file is mapped as container main frame is that is to say, it is convenient
All softwares in container main frame can directly access All Files in the root folder of container main frame, and carry out corresponding position
Reason.
Second aspect, the invention provides a kind of device for realizing container compatible mainframe fictitious host computer image file, the dress
Put including:
Processing unit, for fictitious host computer image file to be mapped as into virtual hard disk using the first operating instruction;
The All Files in virtual hard disk is mapped in the first file of host using the second operating instruction, wherein
First file is any file of host;
The operating system file of fictitious host computer is obtained from the first file;
Start unit, for starting container main frame using the operating system file of fictitious host computer.
The beneficial effects of the invention are as follows:Fictitious host computer image file is mapped as virtual hard disk, then by virtual hard disk
All Files map in the first file of host.Root using the first file as container main frame, from first
The operating system file of fictitious host computer is obtained in file, and using the operating system file of fictitious host computer, starts container main frame.
And in this process, container main frame can compatible fictitious host computer image file, and can be performed after starting corresponding
Action.
Further, processing unit is additionally operable to:
By the second file of business datum File Mapping corresponding to container main frame to host;
The file in file and the second file in the first file, create union file system;
The operating system file of fictitious host computer is obtained from union file system;
Start unit is used for, and according to the operating system file of fictitious host computer, starts container main frame, wherein the second file is
Any file in host in addition to the first file.
It is using the above-mentioned further beneficial effect of scheme:Using the second operating instruction by virtual hard disk it is all that
After File Mapping to the first file of host, the business datum of container main frame can also be mapped as to the second of host
File.Also, the file in the file and the second file in the first file, create union file system.Enter one
Step obtains the operating system file of fictitious host computer from union file system, and is opened using the operating system file of fictitious host computer
Visibly moved device main frame.And container main frame uses union file system, it is ensured that the performance of container main frame is more preferable.
Further, union file system includes upper strata store path and lower floor's store path, wherein, lower floor's store path
For storing the file of the first file, upper strata store path is used for the file for storing the second file.
It is using the above-mentioned further beneficial effect of scheme:It is above-mentioned further in brief description container main frame make
With union file system, the performance of container main frame can be made more preferable.And be then to describe in detail here, union file system includes upper
Lower two layers of store path, upper strata are used for the data file for storing the second file, that is to say data file corresponding to container main frame;
And it is the image file of fictitious host computer that lower floor, which then stores,.Upper strata can be used for read/write file, and lower floor is then served only for reading file.
It is intended that the different performance for being adapted to different vessels main frame is read or write on upper strata.And lower floor is then read-only, it is therefore an objective to be
Ensure that the image file of fictitious host computer is not changed.
Further, processing unit is additionally operable to, and union file system is mapped as to the root folder of container main frame, to hold
Software in device main frame shares the file in root folder.
It is using the above-mentioned further beneficial effect of scheme:, can be by the first file in container host process is started
Or second file, the root folder of file that fictitious host computer image file is mapped as container main frame is that is to say, it is convenient
All softwares in container main frame can directly access All Files in the root folder of container main frame, and carry out corresponding position
Reason.
Embodiment
In describing below, in order to illustrate rather than in order to limit, it is proposed that such as particular system structure, interface, technology it
The detail of class, thoroughly to understand the present invention.However, it will be clear to one skilled in the art that there is no these specific
The present invention can also be realized in the other embodiments of details.In other situations, omit to well-known system, circuit and
The detailed description of method, in case unnecessary details hinders description of the invention.
Fig. 1 is a kind of method flow for realizing container compatible mainframe fictitious host computer image file provided in an embodiment of the present invention
Schematic diagram, specifically as shown in figure 1, this method includes:
Step 110, fictitious host computer image file is mapped as virtual hard disk using the first operating instruction.
Specifically, first have to obtain store path of the fictitious host computer image file in host.And the first fortune here
Row instruction can such as qemu-nbd instruction, using first operating instruction, from fictitious host computer image file in host
Storage location read fictitious host computer image file, be then mapped as virtual hard disk.For practical application, then be by
I/O operation command mappings instruct for read/write operation.
Step 120, the All Files in virtual hard disk is mapped to the first file of host using the second operating instruction
In folder, wherein the first file is any file of host.
Specifically, the All Files in virtual hard disk is mapped in the first file in host.By step 110
Understand, the All Files in virtual hard disk is exactly the All Files that fictitious host computer image file collects in fact, is simply mapped
Into virtual hard disk.
And in this step, then it is to utilize the second operating instruction, such as mount is instructed the All Files in virtual hard disk
Map in the first file in host.It is actual that the All Files in virtual hard disk is namely deposited in the one of host
In individual file.And this file can be any one file in host.
Step 130, the operating system file of fictitious host computer is obtained from the first file.
Specifically, if container main frame wants the image file of compatible fictitious host computer, actually seek to utilize fictitious host computer
Operation document system, start container main frame.Therefore, the operation document system of fictitious host computer will be got first.
From step 120, the image file of fictitious host computer is by the first file of indirect mappers to host.
So, it is necessary to the operating system file of fictitious host computer is obtained from the first file.
Preferably, the image file of fictitious host computer comprises at least guiding file and operating system file, wherein, guide file
For the store path for the operating system file for indicating fictitious host computer.When fictitious host computer image file indirect mappers to first text
After in part folder, guiding file naturally also maps in the first file therewith.So as long as host reads guiding text
Part, and according to the instruction of guiding file, the operation of fictitious host computer is obtained from the operating system file storage location of fictitious host computer
System file.
After getting the operating system file of fictitious host computer, then step 140 can be can perform.
Step 140, using the operating system file of fictitious host computer, container main frame is started.
End above-mentioned steps, it is already possible to realize the image file of container compatible mainframe fictitious host computer, and can hold
Business corresponding to fictitious host computer is handled in device main frame.
A kind of method for realizing container compatible mainframe fictitious host computer image file provided in an embodiment of the present invention, will virtually lead
Machine image file is mapped as virtual hard disk, then the All Files in virtual hard disk is mapped to the first file of host
In.Root using the first file as container main frame, the operating system file of fictitious host computer is obtained from the first file,
And using the operating system file of fictitious host computer, start container main frame.And in this process, container main frame can be compatible
The image file of fictitious host computer, and can perform corresponding action after starting.
But the performance of the container main frame in such scheme may be more a little better than the performance of fictitious host computer.In order to
The performance of container main frame has been lifted, preferably provides the user service, lifts Consumer's Experience.The embodiment of the present invention also provides
Another method for realizing container compatible mainframe fictitious host computer image file is specific as shown in Fig. 2 this method includes following step
Suddenly:
Step 210, fictitious host computer image file is mapped as virtual hard disk using the first operating instruction.
Specifically, first have to obtain store path of the fictitious host computer image file in host.And the first fortune here
Row instruction can such as qemu-nbd instruction, using first operating instruction, from fictitious host computer image file in host
Storage location read fictitious host computer image file, be then mapped as virtual hard disk.For practical application, then be by
I/O operation command mappings instruct for read/write operation.
Step 220, the All Files in virtual hard disk is mapped to the first file of host using the second operating instruction
In folder, wherein the first file is any file of host.
Specifically, the All Files in virtual hard disk is mapped in the first file in host.By step 210
Understand, the All Files in virtual hard disk is exactly the All Files that fictitious host computer image file collects in fact, is simply mapped
Into virtual hard disk.
And in this step, then it is to map to the All Files in virtual hard disk in the first file in host.
It is actual namely to deposit in the All Files in virtual hard disk in one file of host.And this file can be
Any one file in host.
Step 230, by the second file of business datum File Mapping corresponding to container main frame to host.
Specifically, by the second file in business datum File Mapping to host corresponding to main frame in container, wherein
Second file can be any file in addition to the first file in host.It can also be the file newly created
Folder.And the purpose that business datum corresponding to container main frame is mapped into the second file is, user can according to being actually needed,
The business datum of container main frame is modified by host, in order to be able to reach different demands.
Step 240, the file in the file in the first file and the second file, union file system is created.
Specifically, the file in file and the second file in the first file, creates union file system, its
Real is exactly that a virtual folder that can include All Files in the first file and the second file is created in host.
And this virtual folder includes two layers.It is used to store the file in the second file at the middle and upper levels, that is to say appearance
Business datum file corresponding to device main frame, and lower floor is used to store the file in the first file, that is to say fictitious host computer mirror image
File.And upper strata storage file for can with the file of read/write, and lower floor storage file be then read-only file.Its purpose exists
In, in the case of ensureing that image file does not change, user can arbitrarily change business datum file corresponding to container main frame,
To realize different business functions.If it is desired to lower floor's storage is changed, then when then needing that it is write using union file system
Reproduction technology changes the file in read only layer, and it is operated in file level, and the file in read only layer is made an amendment, file is copied
Shellfish is to writable layers above and then is changed again.It is of course also possible to according to being actually needed, by upper strata be arranged to can/read-write text
Part, lower floor are equally arranged to read/writable file.Or other forms are arranged to according to being actually needed, do not do here any
Limit.
Step 250, container main frame is started according to the operating system file of fictitious host computer.
It is further preferred that when starting container main frame, method also includes step 260, and union file system is mapped as holding
The root folder of device main frame, the file in root folder is shared with the software in Bedpan main frame.
Reader should be understood that maps to the second file by business datum corresponding to container main frame, and should not mirror image text
The benefit that part maps to identical file folder simultaneously includes:
First, image file can be multiplexed.
Specifically, if host starts container main frame, the multi-task is performed.It can equally share in the first file
Incoming " image file " is reflected, a " image file " is corresponded without each single item task, is thus stored to save
Space.
Second, business datum can separate with " image file ", can be in order to managing.
Container host service data can be added, delete or change according to being actually needed.And this is not interfered with
The change or deletion of " image file " etc..Moreover, " image file " can also more redaction at any time, without influenceing business datum
Variation.In a word, after separation, change can be each made at any time, without influenceing other side.
Certainly, if pending business number before mirror image text is mapped into host, in fictitious host computer be present
According to, then the pending business datum of fictitious host computer and image file are then mapped into the first file simultaneously.And the second file
Folder is then the business datum of container main frame.Above-mentioned two somewhat equally applicable, and does not produce any conflict.
Although reader will also be appreciated that the step of some steps of the present embodiment and upper embodiment is not quite similar,
The embodiment can be understood as " upgrade version " of an embodiment, using union file system, can make the property of container main frame
Can more it optimize.And one of above-mentioned two embodiment of the present invention it is implicit the advantages of be, it is not necessary to copy fictitious host computer
Image file is into host, so as to the use of memory space in less host.Utilize mapping relations layer by layer, it is possible to real
The image file of existing container compatible mainframe fictitious host computer, and using the operation document system of fictitious host computer, open container main frame.
Some business of fictitious host computer are handled in container main frame.
Corresponding with above-mentioned two embodiment, the embodiment of the present invention additionally provides one kind and realizes that container compatible mainframe is virtual
The apparatus structure schematic diagram of host mirror image file, specifically as shown in figure 3, the device includes:Processing unit 301 and start unit
302。
Wherein, processing unit 301 is used for, and is mapped as fictitious host computer image file virtually firmly using the first operating instruction
Disk;The All Files in virtual hard disk is mapped in the first file of host using the second operating instruction, wherein first
File is any file of host;The operating system file of fictitious host computer is obtained from the first file.
Preferably, the first file includes:Guide file;Guiding file is used for the operating system text for indicating fictitious host computer
The store path of part, so that host is according to the store path of the operating system file of the fictitious host computer of guiding file instruction, obtain
Take the operating system file of fictitious host computer.
Start unit 302, for starting container main frame using the operating system file of fictitious host computer.
It is further preferred that processing unit 301 is additionally operable to, by business datum File Mapping corresponding to container main frame to host
Second file of machine;The file in file and the second file in the first file, create union file system;From
The operating system file of fictitious host computer is obtained in union file system.
Start unit 302 is used for, and according to the operating system file of fictitious host computer, starts container main frame, wherein the second file
Press from both sides as any file in host in addition to the first file.
Specifically, union file system includes upper strata store path and lower floor's store path, wherein, lower floor's store path is used
In the file for storing the first file, upper strata store path is used for the file for storing the second file.
It is further preferred that processing unit 301 is additionally operable to, union file system is mapped as to the root file of container main frame
Folder, the file in root folder is shared with the software in Bedpan main frame.
Each function in a kind of device for realizing container compatible mainframe fictitious host computer image file provided in an embodiment of the present invention
Method and step performed by unit has done exhaustive presentation in the first two embodiment, easy for narration, will no longer go to live in the household of one's in-laws on getting married here
State.
A kind of device for realizing container compatible mainframe fictitious host computer image file provided in an embodiment of the present invention, will virtually lead
Machine image file is mapped as virtual hard disk, then the All Files in virtual hard disk is mapped to the first file of host
In.Root using the first file as container main frame, the operating system file of fictitious host computer is obtained from the first file,
And using the operating system file of fictitious host computer, start container main frame.And in this process, container main frame can be compatible
The image file of fictitious host computer, and can perform corresponding action after starting.In addition, it is not necessary that the mirror image of copy fictitious host computer
File is into host, so as to the use of memory space in less host.Utilize mapping relations layer by layer, it is possible to realize and hold
The image file of device compatible mainframe fictitious host computer, and using the operation document system of fictitious host computer, open container main frame.Holding
Some business of fictitious host computer are handled in device main frame.
Reader should be understood that in the description of this specification, reference term " one embodiment ", " some embodiments ", " show
The description of example ", " specific example " or " some examples " etc. mean to combine the specific features of the embodiment or example description, structure,
Material or feature are contained at least one embodiment or example of the present invention.In this manual, above-mentioned term is shown
The statement of meaning property need not be directed to identical embodiment or example.Moreover, specific features, structure, material or the feature of description
It can be combined in an appropriate manner in any one or more embodiments or example.In addition, in the case of not conflicting, this
The technical staff in field can be by the different embodiments or example described in this specification and the spy of different embodiments or example
Sign is combined and combined.
It is apparent to those skilled in the art that for convenience of description and succinctly, the dress of foregoing description
The specific work process with unit is put, the corresponding process in preceding method embodiment is may be referred to, will not be repeated here.
In several embodiments provided herein, it should be understood that disclosed apparatus and method, it can be passed through
Its mode is realized.For example, device embodiment described above is only schematical, for example, the division of unit, is only
A kind of division of logic function, can there is an other dividing mode when actually realizing, for example, multiple units or component can combine or
Person is desirably integrated into another system, or some features can be ignored, or does not perform.
The unit illustrated as separating component can be or may not be physically separate, be shown as unit
Part can be or may not be physical location, you can with positioned at a place, or can also be distributed to multiple networks
On unit.Some or all of unit therein can be selected to realize the mesh of scheme of the embodiment of the present invention according to the actual needs
's.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit 301, also may be used
To be that unit is individually physically present or two or more units are integrated in a unit.It is above-mentioned integrated
Unit can both be realized in the form of hardware, can also be realized in the form of SFU software functional unit.
If integrated unit is realized in the form of SFU software functional unit and is used as independent production marketing or in use, can
To be stored in a computer read/write memory medium.Based on such understanding, technical scheme substantially or
Say that the part to be contributed to prior art, or all or part of the technical scheme can be embodied in the form of software product
Out, the computer software product is stored in a storage medium, including some instructions are causing a computer equipment
(can be personal computer, server, or network equipment etc.) performs all or part of each embodiment method of the present invention
Step.And foregoing storage medium includes:It is USB flash disk, mobile hard disk, read-only storage (ROM, Read-Only Memory), random
Access memory (RAM, Random Access Memory), magnetic disc or CD etc. are various can be with Jie of store program codes
Matter.
More than, it is only embodiment of the invention, but protection scope of the present invention is not limited thereto, and it is any to be familiar with
Those skilled in the art the invention discloses technical scope in, various equivalent modifications or substitutions can be readily occurred in,
These modifications or substitutions should be all included within the scope of the present invention.Therefore, protection scope of the present invention should be wanted with right
The protection domain asked is defined.