CN105426230A - Method and system for automatically modifying computer names for system under KVM virtualization platform - Google Patents

Method and system for automatically modifying computer names for system under KVM virtualization platform Download PDF

Info

Publication number
CN105426230A
CN105426230A CN201510906349.6A CN201510906349A CN105426230A CN 105426230 A CN105426230 A CN 105426230A CN 201510906349 A CN201510906349 A CN 201510906349A CN 105426230 A CN105426230 A CN 105426230A
Authority
CN
China
Prior art keywords
computer name
virtual machine
virtualization platform
described virtual
name
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
Application number
CN201510906349.6A
Other languages
Chinese (zh)
Inventor
徐景
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
HUNAN SHENGYUN TECHNOLOGY Co Ltd
Original Assignee
HUNAN SHENGYUN TECHNOLOGY Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by HUNAN SHENGYUN TECHNOLOGY Co Ltd filed Critical HUNAN SHENGYUN TECHNOLOGY Co Ltd
Priority to CN201510906349.6A priority Critical patent/CN105426230A/en
Publication of CN105426230A publication Critical patent/CN105426230A/en
Pending legal-status Critical Current

Links

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The invention provides a method and system for automatically modifying computer names for a system under a KVM virtualization platform. According to the method, a server computer name and a virtual machine computer name are obtained, and are combined into a new computer name according to the preset rule, according to the new computer name, server agency communication information is generated, when it is detected that a virtual machine is started, the server agency communication information is sent to the virtual machine, the virtual machine analyzes the server agency communication information, the new computer name is read, and the virtual machine computer name is modified into the new computer name. In the whole process, the virtual machine computer name does not need to be modified manually, and the computer names can be modified efficiently and automatically.

Description

Under KVM virtualization platform, system revises the method and system of computer name automatically
Technical field
The present invention relates to computer software technical field, particularly relate to the method and system that system under KVM (Kernel-basedVirtualMachine) virtual platform revises computer name automatically.
Background technology
Along with the development of desktop virtual technology, existing increasing company and enterprise start to dispose desktop virtual system at present.
In virtual desktop use procedure, user often needs rapid deployment virtual machine, management platform provides the copy function of virtual machine, but its computer name of windows virtual machine copying out is completely the same, in some application and management scene, computer name still plays very important position, special it is to be mentioned that, in windowsXP operating system, when network existing the computing machine of same names, operating system can continuous reminding user computing machine of the same name.
For above-mentioned situation, generally need setting of modifying manually, waste time and energy, all bring great inconvenience to user and management.
Summary of the invention
Based on this, being necessary to revise computer name manually for needing at present, causing the problem of inefficiency, provide system under a kind of KVM virtualization platform automatically to revise the method and system of computer name, with realize to the efficient of computer name with automatically revise.
Under KVM virtualization platform, system revises a method for computer name automatically, and described KVM virtualization platform comprises interconnective server and virtual machine;
The method that under described KVM virtualization platform, system revises computer name automatically comprises step:
Obtain server computer name and virtual machine computer name;
According to the rule preset, described server computer name and described virtual machine computer name are synthesized new computer name;
According to described new computer name, generation server agent communication message;
When described virtual machine activation being detected, send described server agent communication information to described virtual machine;
Resolve described server agent communication information by described virtual machine, read described new computer name;
Described virtual machine computer name is revised as described new computer name.
Under KVM virtualization platform, system revises a system for computer name automatically, and described KVM virtualization platform comprises interconnective server and virtual machine;
The system that under described KVM virtualization platform, system revises computer name automatically comprises:
Computer name acquisition module, for obtaining server computer name and virtual machine computer name;
Computer name synthesis module, for according to the rule preset, synthesizes new computer name by described server computer name and described virtual machine computer name;
Generation module, for according to described new computer name, generation server agent communication message;
Sending module, for when described virtual machine activation being detected, sends described server agent communication information to described virtual machine;
Read module, for resolving described server agent communication information by described virtual machine, reads described new computer name;
Modified module, for being revised as described new computer name by described virtual machine computer name.
Under KVM virtualization platform of the present invention, system revises the method and system of computer name automatically, obtain server computer name and virtual machine computer name, according to the rule preset, described server computer name and described virtual machine computer name are synthesized new computer name, according to described new computer name, generation server agent communication message, when described virtual machine activation being detected, send described server agent communication information to described virtual machine, described server agent communication information is resolved by described virtual machine, read described new computer name, described virtual machine computer name is revised as described new computer name.In whole process, without the need to revising virtual machine computer name manually, can realize the efficient of computer name and automatically revising.
Accompanying drawing explanation
Fig. 1 is the schematic flow sheet that under KVM virtualization platform of the present invention, system revises method first embodiment of computer name automatically;
Fig. 2 is the schematic flow sheet that under KVM virtualization platform of the present invention, system revises method second embodiment of computer name automatically;
Fig. 3 is the structural representation that under KVM virtualization platform of the present invention, system revises system first embodiment of computer name automatically;
Fig. 4 is the structural representation that under KVM virtualization platform of the present invention, system revises system second embodiment of computer name automatically.
Embodiment
Under KVM virtualization platform, system revises a method for computer name automatically, and described KVM virtualization platform comprises interconnective server and virtual machine.
KVM virtualization platform refers to the cloud computing server system of all employing KVM virtualization technology, in this platform, comprise interconnective server and virtual machine.Virtual machine is generally provided with multiple stage, and what server was unified multiple stage virtual machine is arranged at management.Non-essential, under KVM virtualization platform in system, server is loaded with qemu-kvm program to realize its basic function, virtual machine is loaded with Vdagent program to realize its basic function, Vdagent program is a kind of way of realization of spice agreement in Windows, is used for carrying out communication with qemu-kvm as agency service.In server and virtual machine, be all mounted with operating system, described operating system includes but not limited to (SuSE) Linux OS and windows operating system.
As shown in Figure 1, the method that under described KVM virtualization platform, system revises computer name automatically comprises step:
S100: obtain server computer name and virtual machine computer name.
Server computer name can be obtained by the operating system of server, obtain virtual machine name by the operating system of virtual machine.Such as, when operating system is (SuSE) Linux OS, call API (ApplicationProgrammingInterface, the application programming interface) popen in (SuSE) Linux OS, and fill order hostname obtains Linux computer-name.
S200: according to the rule preset, described server computer name and described virtual machine computer name are synthesized new computer name.
The rule preset presets, and specifically sets according to actual conditions, such as, the most simply can set the regular fashion of the computer name of server computer name+virtual machine computer name=new.In simple terms, the rule preset can regard a default coded system as.
S300: according to described new computer name, generation server agent communication message.
Server agent communication information can be understood as document backup message, and specifically, server agent communication information can be VD_AGENT_FILE_XFER_DATA message.Wherein in an embodiment, step S300 specifically comprises:
Application character path message;
Described new computer name is filled to described character path message, generation server agent communication message.
Server application character path message, is filled into new computer name in character path message, generation server agent communication message.
S400: when described virtual machine activation being detected, sends described server agent communication information to described virtual machine.
Whether can be started by detection VME operating system and judge whether virtual machine starts, when virtual machine activation, send server agent communication information (VD_AGENT_FILE_XFER_DATA message) to described virtual machine.
S500: resolve described server agent communication information by described virtual machine, reads described new computer name.
Virtual machine receives server agent communication information, and it is resolved (can be understood as here and corresponding decode procedure of encoding before), read new computer name.
S600: described virtual machine computer name is revised as described new computer name.
Own computer name is directly revised as new computer name by virtual machine.Specifically, this modification process can call API by VME operating system and come.
Under KVM virtualization platform of the present invention, system revises the method for computer name automatically, obtain server computer name and virtual machine computer name, according to the rule preset, described server computer name and described virtual machine computer name are synthesized new computer name, according to described new computer name, generation server agent communication message, when described virtual machine activation being detected, send described server agent communication information to described virtual machine, described server agent communication information is resolved by described virtual machine, read described new computer name, described virtual machine computer name is revised as described new computer name.In whole process, without the need to revising virtual machine computer name manually, can realize the efficient of computer name and automatically revising.
As shown in Figure 2, wherein in an embodiment, also comprise after institute step S600:
S700: restart described virtual machine.
Restart virtual machine, namely virtual machine has realized amendment automatically and has calculated name.When batch modification computer name need be carried out for a large amount of virtual machine, the operation of above-mentioned S100 ~ S700 can be carried out for every platform virtual machine, realize virtual machine batch, efficiently revise computer name.
Wherein in an embodiment, the described step described virtual machine computer name being revised as described new computer name specifically comprises:
Judge that whether described virtual machine computer name is consistent with described new computer name;
When described virtual machine computer name and described new computer name inconsistent time, described virtual machine computer name is revised as described new computer name;
When described virtual machine computer name is consistent with described new computer name, terminating operation.
Only have when virtual machine computer name and new computer name inconsistent time just need to be revised as new computer name, can avoid like this repeating meaningless amendment virtual machine computer name.
Wherein in an embodiment, described according to described new computer name, the step of generation server agent communication message specifically comprises:
Application character path message;
Described new computer name is filled to described character path message, generation server agent communication message.
Wherein in an embodiment, described when described virtual machine activation being detected, send described server agent communication information to the step of described virtual machine and be specially:
When described virtual machine activation being detected, described server agent communication information is sent to described virtual machine by the passage of SPICE (SimpleProtocolforIndependentComputingEnvironment, independent computation environment simple protocol) agreement.
SPICE is one of three large major technique assemblies of red cap enterprise virtual desktop version, has the remote visiting system agreement of adaptive ability, the identical final user with physical desktop can be provided to experience.
In order to further explain that system revises the technical scheme of the method for computer name automatically under KVM virtualization platform of the present invention in detail, adopting instantiation below and gathering software instruction mode whole technical scheme is described in detail.
In instantiation, load qemu-kvm program in KVM virtualization platform at server end, load Vdagent program at virtual machine client end, server adopts (SuSE) Linux OS, and virtual machine adopts windows operating system.
Step one: call LinuxAPIpopen, fill order hostname obtains server Linux computer-name, obtains virtual machine computer name by windows operating system.
Step 2: call sprintf and linux computer name and virtual machine name are synthesized windows new computer name.
Step 3: apply for a character data path message, fill new information, arrange type of message VD_AGENT_FILE_XFER_DATA, data are the computer name just now synthesized.
Step 4: qemu-kvm detects windows virtual machine activation, once the message that the Vdagent agency service in windows sends be detected, just the message of step 3 is sent to virtual machine.
Step 5: Vdagent agency service Programmable detection also receives VD_AGENT_FILE_XFER_DATA and therefrom takes out new computer name.
Step 6: call WindowsAPIGetComputerNameEx and take out original windows virtual machine computer name, whether consistent by new and old virtual machine computer name, as inconsistent, the SetComputerNameEx just calling WindowsAPI changes computer-name.
Step 7: after arranging the success of new computer name, call InitiateSystemShutdownEx, restart windows, computer name is changed successfully.
Under KVM virtualization platform, system revises a system for computer name automatically, and described KVM virtualization platform comprises interconnective server and virtual machine;
As shown in Figure 3, the system that under described KVM virtualization platform, system revises computer name automatically comprises:
Computer name acquisition module 100, for obtaining server computer name and virtual machine computer name;
Computer name synthesis module 200, for according to the rule preset, synthesizes new computer name by described server computer name and described virtual machine computer name;
Generation module 300, for according to described new computer name, generation server agent communication message;
Sending module 400, for when described virtual machine activation being detected, sends described server agent communication information to described virtual machine;
Read module 500, for resolving described server agent communication information by described virtual machine, reads described new computer name;
Modified module 600, for being revised as described new computer name by described virtual machine computer name.
As shown in Figure 4, wherein in an embodiment, the system that under described KVM virtualization platform, system revises computer name automatically also comprises:
Restart module 700, for restarting described virtual machine.
Wherein in an embodiment, described modified module 600 specifically comprises:
Judging unit, for judging that whether described virtual machine computer name is consistent with described new computer name;
First processing unit, for when described virtual machine computer name and described new computer name inconsistent time, described virtual machine computer name is revised as described new computer name;
Second processing unit, for when described virtual machine computer name is consistent with described new computer name, terminating operation.
Wherein in an embodiment, described generation module 300 specifically comprises:
Application unit, for applying for character path message;
Generation unit, for described new computer name is filled to described character path message, generation server agent communication message.
Wherein in an embodiment, described sending module 400, specifically for when described virtual machine activation being detected, sends described server agent communication information to described virtual machine by the passage of SPICE agreement.
In order to further explain that system revises the technical scheme of the method and system of computer name automatically under KVM virtualization platform of the present invention in detail, will an instantiation be adopted in addition to be described below.
In instantiation: KVM virtualization platform comprises server and 3 virtual machines, server adopts (SuSE) Linux OS, is loaded with qemu-kvm program, and virtual machine adopts windows operating system, is loaded with Vdagent program.
Step one: after qemu-kvm process initiation, qemu-kvm program is according to the title of current virtual machine, virtual machine computer name is called " clone1 ", obtain the computer name of kvm virtual platform server simultaneously, server computer name is called " SY01 ", be combined into a character string " SY01-clone01 ", be labeled as C1.
Step 2: qemu-kvm program applies for a character data path message further, is labeled as M1, and fills new information, arranges type of message VD_AGENT_FILE_XFER_DATA, the data of filling are C1 in previous step.
Namely step 3: VME operating system starts startup optimization is windowsXP os starting, and client agent program is installed in the mode of system service program " RHEVSpiceAgent " and runs in VME operating system.After windowsXP system starts, agent service routine starts with other services of system and runs, and agent program will carry out a series of communication activity with service end qemu-kvm program, as the negotiation of desktop resolution, character device initiation message etc. after starting.Now utilize the communication activity of this type of character device initiation message, namely qemu-kvm is as serve end program, and agent initiatively sends character device initiation message to qemu-kvm service end as client-side program.
Step 4: qemu-kvm program, after receiving the character device initiation message that virtual machine agent sends over, carries out respective handling immediately.M1 ready in step 3 is returned to agent client.
Step 5: client agent process accepts is to M1 message, and therefrom take out character string C1, call windows system api interface function further, whether the current computer name of comparison is consistent with C1, if consistent, skip subsequent step, if inconsistent, then continue calling system api interface function, the computer name of amendment native system, a successfully modified laggard step windows system api interface function setup computing machine is restarted and comes into force.
Step 6: after virtual machine is restarted, the computer name that can be observed windowsXP system has been modified to, and " so far, the calculating name of separate unit virtual machine has realized automatically revising and restarting coming into force SY01-clone1.
Step 7: can realize automatically revising computer name for the operation of residue 2 virtual machines repetition above-mentioned steps one to step 6.
The above embodiment only have expressed several embodiment of the present invention, and it describes comparatively concrete and detailed, but can not therefore be construed as limiting the scope of the patent.It should be pointed out that for the person of ordinary skill of the art, without departing from the inventive concept of the premise, can also make some distortion and improvement, these all belong to protection scope of the present invention.Therefore, the protection domain of patent of the present invention should be as the criterion with claims.

Claims (10)

1. under KVM virtualization platform, system revises a method for computer name automatically, it is characterized in that, described KVM virtualization platform comprises interconnective server and virtual machine;
The method that under described KVM virtualization platform, system revises computer name automatically comprises step:
Obtain server computer name and virtual machine computer name;
According to the rule preset, described server computer name and described virtual machine computer name are synthesized new computer name;
According to described new computer name, generation server agent communication message;
When described virtual machine activation being detected, send described server agent communication information to described virtual machine;
Resolve described server agent communication information by described virtual machine, read described new computer name;
Described virtual machine computer name is revised as described new computer name.
2. under KVM virtualization platform according to claim 1, system revises the method for computer name automatically, it is characterized in that, described described virtual machine computer name is revised as the step of described new computer name after also comprise:
Restart described virtual machine.
3. under KVM virtualization platform according to claim 1 and 2, system revises the method for computer name automatically, it is characterized in that, the described step described virtual machine computer name being revised as described new computer name specifically comprises:
Judge that whether described virtual machine computer name is consistent with described new computer name;
When described virtual machine computer name and described new computer name inconsistent time, described virtual machine computer name is revised as described new computer name;
When described virtual machine computer name is consistent with described new computer name, terminating operation.
4. under KVM virtualization platform according to claim 1 and 2, system revises the method for computer name automatically, it is characterized in that, described according to described new computer name, the step of generation server agent communication message specifically comprises:
Application character path message;
Described new computer name is filled to described character path message, generation server agent communication message.
5. under KVM virtualization platform according to claim 1 and 2, system revises the method for computer name automatically, it is characterized in that, described when described virtual machine activation being detected, sends described server agent communication information to the step of described virtual machine and is specially:
When described virtual machine activation being detected, send described server agent communication information to described virtual machine by the passage of SPICE agreement.
6. under KVM virtualization platform, system revises a system for computer name automatically, it is characterized in that, described KVM virtualization platform comprises interconnective server and virtual machine;
The system that under described KVM virtualization platform, system revises computer name automatically comprises:
Computer name acquisition module, for obtaining server computer name and virtual machine computer name;
Computer name synthesis module, for according to the rule preset, synthesizes new computer name by described server computer name and described virtual machine computer name;
Generation module, for according to described new computer name, generation server agent communication message;
Sending module, for when described virtual machine activation being detected, sends described server agent communication information to described virtual machine;
Read module, for resolving described server agent communication information by described virtual machine, reads described new computer name;
Modified module, for being revised as described new computer name by described virtual machine computer name.
7. under KVM virtualization platform according to claim 6, system revises the system of computer name automatically, it is characterized in that, also comprises:
Restart module, for restarting described virtual machine.
8. under the KVM virtualization platform according to claim 6 or 7, system revises the system of computer name automatically, it is characterized in that, described modified module specifically comprises:
Judging unit, for judging that whether described virtual machine computer name is consistent with described new computer name;
First processing unit, for when described virtual machine computer name and described new computer name inconsistent time, described virtual machine computer name is revised as described new computer name;
Second processing unit, for when described virtual machine computer name is consistent with described new computer name, terminating operation.
9. under the KVM virtualization platform according to claim 6 or 7, system revises the system of computer name automatically, it is characterized in that, described generation module specifically comprises:
Application unit, for applying for character path message;
Generation unit, for described new computer name is filled to described character path message, generation server agent communication message.
10. under the KVM virtualization platform according to claim 6 or 7, system revises the system of computer name automatically, it is characterized in that, described sending module, specifically for when described virtual machine activation being detected, sends described server agent communication information to described virtual machine by the passage of SPICE agreement.
CN201510906349.6A 2015-12-09 2015-12-09 Method and system for automatically modifying computer names for system under KVM virtualization platform Pending CN105426230A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510906349.6A CN105426230A (en) 2015-12-09 2015-12-09 Method and system for automatically modifying computer names for system under KVM virtualization platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510906349.6A CN105426230A (en) 2015-12-09 2015-12-09 Method and system for automatically modifying computer names for system under KVM virtualization platform

Publications (1)

Publication Number Publication Date
CN105426230A true CN105426230A (en) 2016-03-23

Family

ID=55504457

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510906349.6A Pending CN105426230A (en) 2015-12-09 2015-12-09 Method and system for automatically modifying computer names for system under KVM virtualization platform

Country Status (1)

Country Link
CN (1) CN105426230A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109101314A (en) * 2017-06-20 2018-12-28 西门子股份公司 Make the method and apparatus of the virtual machine of the first computer access second computer

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103685441A (en) * 2013-07-02 2014-03-26 重庆绿色智能技术研究院 Remote desktop control system based on Loongson terminal
CN103677961A (en) * 2013-12-20 2014-03-26 国云科技股份有限公司 Method for setting host name of virtual machine
CN104111862A (en) * 2014-07-17 2014-10-22 湖南昇云科技有限公司 Method and system for obtaining IP (Internet Protocol) address of virtual machine in cloud computing platform
US9164749B2 (en) * 2008-08-29 2015-10-20 Red Hat, Inc. Differential software provisioning on virtual machines having different configurations
CN105045663A (en) * 2015-08-24 2015-11-11 湖南昇云科技有限公司 Method and system for rapidly deploying virtual machine

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9164749B2 (en) * 2008-08-29 2015-10-20 Red Hat, Inc. Differential software provisioning on virtual machines having different configurations
CN103685441A (en) * 2013-07-02 2014-03-26 重庆绿色智能技术研究院 Remote desktop control system based on Loongson terminal
CN103677961A (en) * 2013-12-20 2014-03-26 国云科技股份有限公司 Method for setting host name of virtual machine
CN104111862A (en) * 2014-07-17 2014-10-22 湖南昇云科技有限公司 Method and system for obtaining IP (Internet Protocol) address of virtual machine in cloud computing platform
CN105045663A (en) * 2015-08-24 2015-11-11 湖南昇云科技有限公司 Method and system for rapidly deploying virtual machine

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109101314A (en) * 2017-06-20 2018-12-28 西门子股份公司 Make the method and apparatus of the virtual machine of the first computer access second computer
US11188356B2 (en) 2017-06-20 2021-11-30 Siemens Aktiengesellschaft Method and arrangement to access a first computer on a virtual machine of a second computer

Similar Documents

Publication Publication Date Title
CN108039969B (en) Network automatic configuration method, device, system, storage medium and target computer
CN102129378B (en) A kind of software menu updating method and device
CN102523268B (en) Client side upgrading method and system
CN108632375B (en) Online upgrading method for distributed deployment service software program
CN110557433B (en) Resource management method, platform, cloud gateway, system and storage medium
TWI626593B (en) Method and apparatus for upgrading software
US11057827B1 (en) Provisioning an embedded universal integrated circuit card (eUICC) of a mobile communication device
CN1685395A (en) System and method for use of multiple applications
CN103533011A (en) Intelligent terminal data configuration method and system based on cloud terminal
CN106713004B (en) Router adaptation method and system
CN102457541A (en) System and method for avoiding resource competition during starting diskless workstation
US10404568B2 (en) Agent manager for distributed transaction monitoring system
CN111026439B (en) Application program compatibility method, device, equipment and computer storage medium
CN106980502A (en) A kind of online method for obtaining BIOS/firmware renewal
CN107018189A (en) Migrate application data and receive the method and device of application data
CN107729117B (en) Virtual machine generation method and system
CN113312083A (en) Application generation method, device and equipment
CN105426230A (en) Method and system for automatically modifying computer names for system under KVM virtualization platform
WO2021139261A1 (en) Application deployment method and device, and medium
CN102932968B (en) The method of data card and data card networking
CN104348646A (en) Configuration data processing method, device and system
CN110768811B (en) Method, device and system for updating YANG model file library
CN106815006B (en) Page calling method and device and page management server
CN112685102B (en) Gateway plug-in hot loading method, device, equipment and medium
CN102137058B (en) A kind of page access method and apparatus based on tab page

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20160323

WD01 Invention patent application deemed withdrawn after publication