The system and method for shared file between a kind of virtual machineTechnical field
The present invention relates to virtual machine technique fields, and in particular to the system and method for shared file between a kind of virtual machine.
Background technique
Virtual machine is the core of virtualization system, is the performance most concentrated to server resource virtualization applications.By physicsThe resources such as server are abstracted into more virtual machines in system, are upper to realize the virtual fusion and efficiently management of physical resourceLayer service provides powerful core calculations ability, and simultaneous retractable is that upper-layer service provides continual reliable guarantee.
In the prior art, between virtual machine usually by way of disk access shared file, the mode of this kind of shared fileThe biggish computing resource of virtual machine is generally taken up, the normal use of virtual machine is influenced.In view of the above-mentioned problems, the present invention proposes one kindThe system and method for shared file between virtual machine.
Summary of the invention
It is an object of the present invention to a kind of system and method for shared file between virtual machine be proposed, to solve above-mentioned technologyProblem.
In a first aspect, the system that the present invention proposes shared file between a kind of virtual machine, comprising: server-side and be able to carry outThe client of server-side file access;
The server-side includes:
Display module: for showing shared file to client;
Processing module: for obtaining the selected corresponding storage region of shared file of client, and pass through resource managerThe storage region is distributed to client;
The client includes:
Chosen module: for selecting the shared file of server-side offer;
Access modules: the shared file in storage region for accessing server-side distribution.
Further, the server-side further include:
Judgment module: for determining the shared attribute of the selected shared file of client;
When the shared attribute of the shared file, which is, allows shared, into processing module;
When the shared attribute of the shared file is to forbid shared, server-side forbids providing the shared text to clientPart.
Further, pass through NFS communication for service between server-side and client;The file of server-side is configured to assign power.
Further, the display module is specifically used for:
System file in scanning storage generates shared file directory entry, the corresponding index of the shared file directory entryNodal information uniquely determines the storage region of shared file;
Shared file is shown to client by shared file directory entry.
Second aspect, the method that the present invention proposes shared file between a kind of virtual machine characterized by comprising
SS1, server-side show shared file to client;
SS2, client select the shared file that server-side provides;
SS3, server-side obtain the selected corresponding storage region of shared file of client, and pass through resource manager for instituteStorage region is stated to distribute to client;
The shared file in storage region that SS4, client access server-side are distributed.
Further, between step SS2 and step SS3 further include:
Server-side determines the shared attribute of the selected shared file of client:
When the shared attribute of the shared file, which is, allows shared, step SS3 is executed;
When the shared attribute of the shared file is to forbid shared, stop executing step SS3, server-side is forbidden to clientEnd provides the shared file.
Further, before step SS1 further include:
Configuration server-side and the client for being able to carry out server-side file access, specifically include:
The NFS service between server-side and client is configured, and the file for configuring server-side assigns power.
Further, step SS1 is specifically included:
System file in scanning storage generates shared file directory entry, the corresponding index of the shared file directory entryNodal information uniquely determines the storage region of shared file;
Shared file is shown to client by shared file directory entry.
A kind of system configuring virtual machine shared file proposed by the present invention, passes through the file between client and server-sideAccess solves between virtual machine in the prior art through disk visit and by way of resource manager storage region is distributedThe form shared file bring asked occupies virtual machine computing resource, influences the problem of virtual machine normal use, substantially increasesThe use space and computational efficiency of virtual machine.Meanwhile the form that shared attribute determines is carried out to shared file in the present invention, so thatVirtual machine realizes effective control to storage file, avoid virtual machine arbitrarily the control of difficulty or ease caused by shared file andOther problems.The present invention also provides the sides for server-side virtual machine and client configure and then being carried out file accessMethod enables virtual-machine client to carry out file access to server-side, increases the service flexibility of virtual machine product, so thatVirtual machine more adapts to the demand of enterprise-class tools.
The beneficial effect of the method for shared file is as described above, be not repeated to go to live in the household of one's in-laws on getting married between a kind of virtual machine proposed by the present inventionIt states.
Detailed description of the invention
Illustrate the embodiment of the present invention in order to clearer, attached drawing needed in the embodiment is done into simple Jie belowIt continues, it is clear that, drawings in the following description are only some embodiments of the invention, for those of ordinary skill in the artFor, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is the systematic schematic diagram of shared file between virtual machine disclosed in the embodiment of the present invention.
Fig. 2 is the method flow diagram of shared file between virtual machine disclosed in the embodiment of the present invention.
Specific embodiment
With reference to the attached drawing in the embodiment of the present invention, clear and complete retouch is carried out to the technical solution in inventive embodimentsIt states, it is clear that described embodiment is only a part of the embodiments of the present invention, rather than whole embodiments.Based on the present inventionIn embodiment, those of ordinary skill in the art without making creative work, every other implementation obtainedExample, belongs to the scope of the present invention.
In order to make those skilled in the art better understand the present invention program, with reference to the accompanying drawings and detailed descriptionThe present invention is described in further detail.
Embodiment 1
The present embodiment provides a kind of system of shared file between virtual machine, as shown in Figure 1, comprising: server-side 2 and energyEnough carry out the client 1 of 2 file access of server-side;
The server-side includes:
Display module 201: for showing shared file to client 1;
Processing module 202: for obtaining the selected corresponding storage region of shared file of client 1, and pass through resource pipeReason device distributes the storage region to client 1;
The client 11 includes:
Chosen module 101: for selecting the shared file of the offer of server-side 2;
Access modules 102: the shared file in storage region for accessing the distribution of server-side 2.
This implementation also provides a kind of method of shared file between virtual machine, as shown in Figure 2, comprising:
SS1, server-side 2 show shared file to client 1;
SS2, client 1 select the shared file of the offer of server-side 2;
SS3, server-side 2 obtain the selected corresponding storage region of shared file of client 1, and will by resource managerThe storage region is distributed to client 1;
SS4, client 1 access the shared file in the storage region that server-side 2 is distributed.
Embodiment 2
The present embodiment provides a kind of systems of shared file between virtual machine, comprising: server-side 2 and is able to carry out server-sideThe client 1 of 2 file accesss;
The server-side 2 includes:
Display module 201: for showing shared file to client 1;
Judgment module: for determining the shared attribute of the selected shared file of client 1;
When the shared attribute of the shared file, which is, allows shared, into processing module 202;
When the shared attribute of the shared file is to forbid shared, server-side 2 forbids providing the shared text to client 1Part;
Processing module 202: for obtaining the selected corresponding storage region of shared file of client 1, and pass through resource pipeReason device distributes the storage region to client 1;
The client 1 includes:
Chosen module 101: for selecting the shared file of the offer of server-side 2;
Access modules 102: the shared file in storage region for accessing the distribution of server-side 2.
In the present embodiment, above-mentioned display module 201 is specifically used for:
System file in scanning storage generates shared file directory entry, the corresponding index of the shared file directory entryNodal information uniquely determines the storage region of shared file;
Shared file is shown to client 1 by shared file directory entry.
In the present embodiment, pass through NFS communication for service between server-side 2 and client 1;The file of server-side 2 is configured to assignPower.For configuring server-side 2 in InCloud Sphere system and be able to carry out the client 1 of 2 file access of server-side,Concrete operations are as follows:
1) virtual machine environment is configured, is specifically included:
Add licensing;
Increase host;
Creation storage, including it is locally stored and shares storage.
2) virtual machine service end 2 and client 1 are configured, is specifically included:
Respectively server-side 2 and client 1 configure centOS operating system, and distribute 4 core CPU, 4G memories, and 40G is hardDisk;
Server-side 2 and visitor is respectively configured by/etc/sysconfig/network-scripts/ifcfg-eth0 orderFamily end 1IP, and systemctl restart network is executed, so that configuration of IP is come into force.
3) the NFS service between server-side 2 and client 1 is configured, and the file for configuring server-side 2 assigns power, specifically includes:
Server-side 2:
It executes yum install nfs-utils order and configures NFS server-side 2;
Vi/etc/exports order is executed, configuration allows to access the IP of virtual machine, configuration file format are as follows: the mesh of sharingRecord+access virtual machine IP+ permission;
NFS service is enabled, and is registered to rpcbind, specific instructions are as follows:
Enable service:
/etc/init.d/rpcbind start
/etc/init.d/nfs start
It is registered to rpcbind:
exportfs-arv
It executes showmount-e localhost order and checks carry;
It executes chmod 777/mnt/file order and modifies path permission;
It executes systemctl disable firewalld order and closes firewall.
Client 1:
It executes yum install nfs-utils order and configures NFS client 1;
Determine mount directory;
It executes mount-t nfs 100.2.100.201:/mnt/file/mnt/nfs order and realizes carry;
The shared file of server-side 2 is checked after the completion of carry.
This implementation also provides a kind of method of shared file between virtual machine, comprising:
SS1, configuration server-side 2 and the client 1 for being able to carry out 2 file access of server-side, specifically include:
The NFS service between server-side 2 and client 1 is configured, and the file for configuring server-side 2 assigns power.
SS2, server-side 2 show shared file to client 1;
SS3, client 1 select the shared file of the offer of server-side 2;
SS4, server-side 2 determine the shared attribute of the selected shared file of client 1:
When the shared attribute of the shared file, which is, allows shared, step SS5 is executed;
When the shared attribute of the shared file is to forbid shared, stop executing step SS5, server-side 2 is forbidden to visitorFamily end 1 provides the shared file.
SS5, server-side 2 obtain the selected corresponding storage region of shared file of client 1, and will by resource managerThe storage region is distributed to client 1;
SS6, client 1 access the shared file in the storage region that server-side 2 is distributed.
In the present embodiment, step SS2 is specifically included:
System file in scanning storage generates shared file directory entry, the corresponding index of the shared file directory entryNodal information uniquely determines the storage region of shared file;
Shared file is shown to client 1 by shared file directory entry.
The system and method for shared file a kind of virtual machine disclosed by the invention is described in detail above.ExplanationEach embodiment is described in a progressive manner in book, the highlights of each of the examples are it is different from other embodiments itPlace, the same or similar parts in each embodiment may refer to each other.For the system disclosed in the embodiment, due to itself and realityIt applies that method disclosed in example is corresponding, therefore describes relatively simple, correlation can go out referring to method part illustration.It is described aboveIt is only the preferred embodiment of the present invention, it should be pointed out that: for those skilled in the art, do not departing from thisUnder the premise of inventive principle, several improvements and modifications can also be made, these improvements and modifications also should be regarded as protection of the inventionRange.