CN112698918A - Virtual machine file generation method and device based on construction environment - Google Patents

Virtual machine file generation method and device based on construction environment Download PDF

Info

Publication number
CN112698918A
CN112698918A CN202110013164.8A CN202110013164A CN112698918A CN 112698918 A CN112698918 A CN 112698918A CN 202110013164 A CN202110013164 A CN 202110013164A CN 112698918 A CN112698918 A CN 112698918A
Authority
CN
China
Prior art keywords
virtual machine
software
hardware
information
file
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
CN202110013164.8A
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.)
Shanghai Hode Information Technology Co Ltd
Original Assignee
Shanghai Hode Information 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 Shanghai Hode Information Technology Co Ltd filed Critical Shanghai Hode Information Technology Co Ltd
Priority to CN202110013164.8A priority Critical patent/CN112698918A/en
Publication of CN112698918A publication Critical patent/CN112698918A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a virtual machine file generation method and device based on a construction environment. The method comprises the following steps: acquiring software and hardware configuration and software dependence required by the built construction environment; generating a configuration file with a preset format according to the software and hardware configuration and the software dependence; creating a virtual machine, and creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file; after the virtual machine hardware and the virtual machine software are established in the virtual machine, the virtual machine containing the virtual machine hardware and the virtual machine software is saved to generate a virtual machine file. The construction environments built on different physical machines can be kept consistent.

Description

Virtual machine file generation method and device based on construction environment
Technical Field
The application relates to the technical field of virtual machines, in particular to a virtual machine file generation method and device based on a construction environment.
Background
Software toolkits generally need to be operated in a specific development environment to operate normally. In the prior art, in order to enable a software toolkit to normally operate, software and services on which the software toolkit depends are installed on a hardware physical machine, and building of a building environment of the software toolkit is achieved.
Disclosure of Invention
In view of this, a method, an apparatus, a computer device, and a computer-readable storage medium for generating a virtual machine file based on a build environment are provided to solve the problem that it cannot be guaranteed that build environments built on other physical machines cannot be completely consistent in the prior art.
The application provides a virtual machine file generation method based on a construction environment, which comprises the following steps:
acquiring software and hardware configuration and software dependence required by the built construction environment;
generating a configuration file with a preset format according to the software and hardware configuration and the software dependence;
creating a virtual machine, and creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file;
after the virtual machine hardware and the virtual machine software are established in the virtual machine, the virtual machine containing the virtual machine hardware and the virtual machine software is saved to generate a virtual machine file.
Optionally, the creating, in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file, virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information includes:
analyzing the configuration file to obtain software and hardware configuration information and software dependence information;
and creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependence information in the virtual machine by using a preset script according to the software and hardware configuration information and the software dependence information.
Optionally, the creating, by using a preset script in the virtual machine according to the software and hardware configuration information and the software dependency information, virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information includes:
calling a preset first interface in the virtual machine by using the script according to hardware configuration information in the software and hardware configuration information to simulate virtual machine hardware corresponding to the hardware configuration information;
and calling a preset second interface by using the script in the virtual machine according to software configuration information in the software and hardware configuration information to realize the installation of an operating system of a version corresponding to the software configuration information, and calling a preset third interface by using the script in the operating system according to the software dependency information to realize the installation of software corresponding to the software dependency information, so as to realize the creation of the virtual machine software in the virtual machine.
Optionally, the creating, in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file, virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information includes:
respectively creating virtual machine hardware and virtual machine software corresponding to each operating system in the virtual machine according to hardware configuration information, multiple types of operating system information and software dependence information corresponding to each operating system in the configuration file;
after the virtual machine hardware and the virtual machine software are created in the virtual machine, storing the virtual machine including the virtual machine hardware and the virtual machine software to generate a virtual machine file includes:
after the virtual machine hardware and the virtual machine software corresponding to each operating system are finished in the virtual machine, respectively storing the virtual machines containing the virtual machine hardware and the virtual machine software corresponding to different operating systems to obtain virtual machine files corresponding to different operating systems.
Optionally, the configuration file further includes naming information of a virtual machine file to be generated, and the virtual machine file generation method based on the build environment further includes:
and naming the generated virtual machine files of different operating systems according to the naming information.
Optionally, the method for generating a virtual machine file based on a build environment further includes:
after the virtual machine hardware and the virtual machine software are established in the virtual machine, running a preset system instruction to acquire the software-dependent version information of the construction environment;
and comparing the version information with the software dependence information in the configuration file, and determining whether the construction environment is correct according to a comparison result.
Optionally, the build environment is a Unity build environment or a Java build environment.
The application also provides a virtual machine file generation device based on the construction environment, which comprises:
the acquisition module is used for acquiring software and hardware configuration and software dependence required by the built construction environment;
the generating module is used for generating a configuration file in a preset format according to the software and hardware configuration and the software dependence;
the creating module is used for creating a virtual machine and creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file;
and the storage module is used for storing the virtual machine containing the virtual machine hardware and the virtual machine software after the virtual machine completes the creation of the virtual machine hardware and the virtual machine software so as to generate a virtual machine file.
The present application further provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the above method when executing the computer program.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the above-mentioned method.
The beneficial effects of the above technical scheme are that:
in the embodiment of the application, the software and hardware configuration and the software dependence required by the built construction environment are collected; generating a configuration file with a preset format according to the software and hardware configuration and the software dependence; creating a virtual machine, and creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file; after the virtual machine hardware and the virtual machine software are established in the virtual machine, the virtual machine containing the virtual machine hardware and the virtual machine software is saved to generate a virtual machine file. In the embodiment of the application, based on the collected software and hardware configuration and software dependence required by the construction environment, configuration steps such as hardware configuration, software dependence and the like in the construction environment construction process are integrated into a self-defined construction environment construction system in a self-defined configuration file mode, so that a virtual machine file containing the construction environment can be conveniently constructed on the basis of virtualization technology, and the virtual machine file can be conveniently subjected to cross-machine seamless migration. When a set of new construction environment is needed, the manufactured virtual machine file is copied to a new physical machine, and the construction work of the construction environment is not needed to be carried out once again. As the finally manufactured virtual machine file without any external dependence is the same as the finally manufactured virtual machine file, the consistency of the constructed environment formed after the virtual machine is operated is naturally ensured as long as the virtual machine file is ensured to be consistent. Therefore, the construction environment obtained by the method can ensure that all the construction environments are completely consistent, the construction efficiency of the construction environment can be greatly improved, the consistency of all the construction environments is ensured to the maximum extent, and stable infrastructure support is provided for the normal operation of the continuous delivery system.
Drawings
Fig. 1 is an environment schematic diagram of a virtual machine file generation method based on a build environment according to an embodiment of the present application;
FIG. 2 is a flowchart of an embodiment of a method for generating a virtual machine file based on a build environment according to the present application;
fig. 3 is a flowchart illustrating a detailed process of creating virtual machine hardware and virtual machine software corresponding to software and hardware configuration information and software dependency information in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file in an embodiment of the present application;
fig. 4 is a flowchart illustrating a detailed process of creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine by using a preset script according to the software and hardware configuration information and the software dependency information in an embodiment of the present application;
FIG. 5 is a flowchart of another embodiment of a method for generating a virtual machine file based on a build environment according to the present application;
FIG. 6 is a block diagram of a program of one embodiment of an apparatus for creating a virtual machine file based on a build environment according to the present application;
fig. 7 is a schematic hardware structure diagram of a computer device that executes a virtual machine file generation method based on a build environment according to an embodiment of the present application.
Detailed Description
The advantages of the present application are further illustrated below with reference to the accompanying drawings and specific embodiments.
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The terminology used in the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used in this disclosure and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present disclosure. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
In the description of the present application, it should be understood that the numerical references before the steps do not identify the order of performing the steps, but merely serve to facilitate the description of the present application and to distinguish each step, and therefore should not be construed as limiting the present application.
Fig. 1 schematically shows a framework diagram of a virtual machine file generation method based on a build environment according to an embodiment of the present application. In an exemplary embodiment, the system of the application environment may include a computer device 7, a server 20. Wherein the computer device 7 forms a wireless or wired connection with the server 20 and the server 10 has an application program (APP) installed therein. The server 10 may be a mobile phone, an iPAD, a tablet, a server, etc. The server 20 may be a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster composed of a plurality of servers).
Fig. 2 is a schematic flowchart of a virtual machine file generation method based on a build environment according to an embodiment of the present application. It should be understood that the flow charts in the embodiments of the present method are not used to limit the order of executing the steps. In the following, a computer device is taken as an execution subject to be exemplarily described, and as can be seen from the figure, the method for generating a virtual machine file based on a build environment provided in this embodiment includes:
and step S20, collecting software and hardware configuration and software dependence required by the built construction environment.
Specifically, the building environment is a development environment required for executing various building tasks, for example, a development environment required for building a game package, building game resources, and the like, and the building environment includes software dependence, software and hardware configuration, and the like.
The software dependency refers to that one software package depends on other necessary software packages, so that a software package system forms a complex dependency relationship network, and the dependency relationship is called as software dependency.
The software and hardware configuration comprises software configuration and hardware configuration, wherein the software configuration refers to hardware configuration requirements required for building the construction environment and comprises configuration items such as CPU core number, memory size, hard disk size and the like; the software configuration refers to the software configuration requirements needed to build the build environment, including the name of the operating system (e.g., os _ name) and the version of the operating system (e.g., os _ version).
As an example, the build environment may be specifically a Unity build environment or a Java build environment, where Unity is a multi-platform integrated game development tool developed by Unity Technologies for players to easily create interactive content of the type such as three-dimensional video games, building visualizations, real-time three-dimensional animations, and is a fully integrated professional game engine.
In an exemplary embodiment, the building environment is the Unity building environment, and before acquiring the software and hardware configuration and the software dependency, a user can collect the software and hardware configuration and the software dependency required for building the Unity building environment in advance according to the requirement for building the Unity building environment, that is, at least the operating system of a specific version, the specified Unity version, the required Unity component system, the required Android SDK, the required NDK, the required XCode, and other software dependencies need to be collected. After the information is collected, the information can be stored, so that when the Unity construction environment is built subsequently, the software and hardware configuration and software dependence required for building the Unity construction environment can be directly collected from the information stored in advance. In another embodiment, when the software and hardware configuration and the software dependency required for building the construction environment are collected, the software and hardware configuration and the software dependency required for building the construction environment can be obtained by analyzing the construction environment built on the current physical machine, so that the software and hardware configuration and the software dependency required for building the construction environment can be collected.
The physical machine is a hardware physical machine such as MacPro, MacMini, or the like.
And step S21, generating a configuration file with a preset format according to the software and hardware configuration and the software dependence.
Specifically, the configuration file in the preset format is a configuration file in a format customized by a user, and in an exemplary embodiment, a configuration file in a json format may be generated, where the configuration file in the format may include the following configuration contents:
the version field represents our version of this configuration file; representing the project _ name field as the project to which the built construction environment belongs; a provider field and a provider _ type field respectively represent the type of the provided virtual machine and the provider of the virtual machine standard; representing the configuration of hardware and software of the host machine by a host field, and representing the configuration requirement of the virtual machine to be constructed by a vm field; representing the hardware configuration requirement by a hardware field, wherein the hardware field can comprise configuration items such as the number of CPU cores, the size of a memory, the size of a hard disk and the like; representing the software configuration requirement by a software field, and comprising configuration items such as the name os _ name of an operating system and the version os _ version of the operating system; the dependency field represents the specific software dependency in the software configuration, and is used for expressing the name of the software and the version of the software respectively.
Step S23, creating a virtual machine, and creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file.
Specifically, the created virtual machine is a template virtual machine, that is, a virtual machine that only contains the basic configuration, for example, a virtual machine that only contains the default hardware configuration and the operating system, and has no other software installed. The virtual machine refers to a complete computer system which has complete hardware system functions and runs in a completely isolated environment through software simulation. The work that can be done in a physical computer can be implemented in a virtual machine. When creating a virtual machine in a computer, it is necessary to use a part of the hard disk and the memory capacity of the physical machine as the hard disk and the memory capacity of the virtual machine. Each virtual machine has an independent CMOS, hard disk and operating system, and can be operated like a physical machine.
As an example, after the virtual machine is created, software and hardware configuration update and software dependency installation may be performed on the created virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file, so as to create the virtual machine hardware and the virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine. Specifically, the required virtual machine hardware and virtual machine software can be created by calling relevant interfaces of the Hypervisor virtual machine layer, such as command line tools like prlctl, prlsrvctl, prl _ disk _ tool, and the like, and transmitting software and hardware configuration information and the software dependency information in the configuration file. The Hypervisor virtual machine layer is software, firmware or hardware used for establishing and executing a virtual machine. The command line tools prlctl, prlsrvctl, prl _ disk _ tool are tools provided by the provider of the virtual machine standard.
The virtual machine hardware comprises physical hardware such as a hard disk and a memory of the virtual machine, and the virtual machine software comprises an operating system of the virtual machine and various software installed in the operating system.
In an exemplary embodiment, as shown in fig. 3, the step of creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file includes steps S30-S31, where:
and step S30, analyzing the configuration file to obtain software and hardware configuration information and software dependence information.
Specifically, after obtaining the configuration file, the configuration file may be parsed to obtain software and hardware configuration information and software dependency information.
As an example, the hardware configuration information obtained by parsing is as follows:
the CPU has two, supports 32 bit instruction set, memory size is 4096MB, and disk size is 128 GB.
It should be noted that the above hardware configuration information is exemplary and is not intended to limit the present application.
The software configuration information obtained by analysis is as follows:
the operating system is an android system of 8.0-8.1 version, and the installation path is/Applications/gflow/bin/.
It should be noted that the above software configuration information is exemplary and is not intended to limit the present application.
The software dependency information obtained by analysis is as follows:
unit _ editor software with a dependent version number of 2017.4.34f1, unit _ android software with a dependent version number of 2016.5.34f1, java software with a dependent version number of 14.0.1, android-ndk software with a dependent version number of r13b, and android-sdk software.
It should be noted that the above-mentioned software dependency information is exemplary and is not intended to limit the present application.
Step S31, creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine using a preset script according to the software and hardware configuration information and the software dependency information.
Specifically, the script is a code for controlling the virtual machine to automatically create virtual machine hardware and virtual machine software according to the software and hardware configuration information and the software dependency information.
In this embodiment, the virtual machine hardware and the virtual machine software can be automatically created in the virtual machine through the script, so that the operation of creating the virtual machine hardware and the virtual machine software in the virtual machine does not need to be manually executed by a user, and the efficiency of building the construction environment can be improved.
In an exemplary embodiment, as shown in fig. 4, the step S31 may include steps S40-S41, wherein:
step S40, according to the hardware configuration information in the software and hardware configuration information, calling a preset first interface in the virtual machine using the script to simulate the virtual machine hardware corresponding to the hardware configuration information.
Specifically, the first interface is an interface for calling a command line tool that simulates virtual machine hardware, for example, an interface for calling at least one command line tool in the command line tools such as prlctl, prlsrvctl, and prl _ disk _ tool.
By way of example, assuming that the CPU of the created virtual machine is 4-core, the memory is 256M, the hard disk is 128G, and the CPU in the hardware configuration information is 8-core, the memory is 512M, and the hard disk is 256G, a script is used to call a first preset interface, so that a command line tool simulating the virtual machine hardware can be called through the first interface to simulate the hardware before the virtual machine into the virtual machine hardware with the CPU being 8-core, the memory being 512M, and the hard disk being 256G.
Step S41, using the script to call a preset second interface in the virtual machine according to the software configuration information in the software and hardware configuration information to implement installing an operating system of a version corresponding to the software configuration information, and using the script to call a preset third interface in the operating system according to the software dependency information to implement installing software corresponding to the software dependency information, so as to implement creating the virtual machine software in the virtual machine.
Specifically, the second interface is an interface for calling a command line tool of an operating system in which a version corresponding to the software configuration information is installed, for example, an interface for calling at least one command line tool of the command line tools such as prlctl, prlsrvctl, and prl _ disk _ tool. The third interface is an interface for calling a command line tool for installing software corresponding to the software dependency information, for example, an interface for calling at least one command line tool among the command line tools such as prlctl, prlsrvctl, prl _ disk _ tool, and the like.
As an example, assuming that the operating system of the created virtual machine is a version 10.15.5(19F101) maccosx (which is a set of operating systems developed by apple and run on Macintosh series computers), and the operating system included in the software configuration information is a version 10.15.7 maccosx, a script is used to call the second interface, so that a command line tool for installing the version of the operating system corresponding to the software configuration information can be called through the second interface to implement the installation of the version 10.15.7 maccosx in the virtual machine. After the installation of the operating system is completed, the script can be continuously used to call a preset third interface, so that the installation of the software in the operating system can be realized by calling a command line tool for installing the software corresponding to the software dependency information through the third interface, for example, the software to be installed, which is included in the software configuration information, includes unity _ edge @ "2017.4.34f1", unity _ android @ "2017.4.34f1", java @ "14.0.1", android-ndk @ "r13b", and android-sdk, and then the unity _ edge of version number 2017.4.34f1, unity _ android software of version number 2017.4.34f1, java of version number 14.0.1, android-ndk of version number r13b, and android-sdk can be installed in the operating system.
It can be understood that, when the operating system and the software are installed, if the operating system and the software to be installed locally exist in the computer device, the operating system and the software may be directly obtained locally, and if the operating system and the software do not exist locally, the operating system and the software may be obtained from the internet according to the version of the operating system and the version of the software, and then installed in the virtual machine.
In an exemplary embodiment, when a configuration file includes hardware configuration information, information of a plurality of types of operating systems, and software dependency information corresponding to each type of operating system, the creating, in the virtual machine, virtual machine hardware and virtual machine software corresponding to the software configuration information and the software dependency information according to the software configuration information and the software dependency information in the configuration file includes: and respectively creating virtual machine hardware and virtual machine software corresponding to each operating system in the virtual machine according to the hardware configuration information, the multiple types of operating system information and the software dependence information corresponding to each operating system in the configuration file.
Specifically, the multiple types of operation information include version information of at least two operating systems, such as version information of two operating systems: 10.15.5(19F101), and Android Oreo (8.0-8.1) which is a suite of mobile device operating systems developed by Google and the open Handheld device alliance).
Each operating system has software dependency information corresponding to the operating system, for example, the maccosx of 10.15.5(19F101) has the following software dependencies:
unit _ editor software with a dependency version number of 2017.4.34f1, unit _ IOS software with a dependency version number of 2018.4.34f1, java software with a dependency version number of 14.0.1, IOS-ndk software with a dependency version number of r13b, and IOS-sdk software.
Android Oreo from 8.0-8.1 has the following software dependencies:
unit _ editor software with a dependent version number of 2017.4.34f1, unit _ android software with a dependent version number of 2016.5.34f1, java software with a dependent version number of 14.0.1, android-ndk software with a dependent version number of r13b, and android-sdk software.
It should be noted that the version number and the software of the dependent software are exemplary and are not intended to limit the present application.
In this embodiment, when there are multiple types of os information and software dependency information corresponding to each os in the configuration information, when creating the virtual machine hardware and the virtual machine software, a set of the virtual machine hardware and the virtual machine software is created for each os, that is, for the maccosx os of 10.15.5(19F101), a set of the virtual machine hardware and the virtual machine software is created, and for the Android Oreo os of 8.0 to 8.1, a set of the virtual machine hardware and the virtual machine software is also created. The specific creation manner is described in detail in the above embodiments, and is not described in detail in this embodiment.
Step S23, after the virtual machine completes the creation of the virtual machine hardware and the virtual machine software, saving the virtual machine including the virtual machine hardware and the virtual machine software to generate a virtual machine file.
Specifically, after the creation of the virtual machine hardware and the virtual machine software is completed, the virtual machine is saved to obtain a virtual machine file, for example, a virtual machine file GFlow _ VM _1.pvm, where the virtual machine file is the finally required constructed construction environment.
In an exemplary embodiment, when the corresponding virtual machine hardware and virtual machine software are created for each operating system, after the virtual machine hardware and virtual machine software are completed, the virtual machines including the virtual machine hardware and virtual machine software corresponding to different operating systems may be respectively saved to obtain virtual machine files corresponding to different operating systems, for example, to obtain virtual machine files GFlow _ VM _1, pvm, GFlow _ VM _2, pvm, GFlow _ VM _3, pvm. As an example, the three virtual machine files may be Unity Android, Unity iOS, and Unity Web, that is, the Unity is the construction environments under the Android system, iOS system, and Window system, respectively, and the construction environments are isolated and independent from each other.
In an exemplary embodiment, in order to facilitate distinguishing virtual machine files generated for different operating systems, naming information of the virtual machine file to be generated may be added in a configuration file in advance, for example, for a virtual machine file to be generated for an Android system, the following naming information may be added in the configuration file: VM1_ name: "GFlow _ VM _ 1"; for a virtual machine file to be generated of the iOS system, the following naming information may be added in the configuration file: VM2_ name: "GFlow _ VM _ 2"; for a virtual machine file to be generated in a Window system, the following naming information can be added in a configuration file: VM1_ name: "GFlow _ VM _ 3". Therefore, when virtual machine files corresponding to different operating systems are generated subsequently, the generated virtual machine files of the different operating systems can be named according to the naming information.
In the embodiment of the application, the software and hardware configuration and the software dependence required by the built construction environment are collected; generating a configuration file with a preset format according to the software and hardware configuration and the software dependence; creating a virtual machine, and creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file; after the virtual machine hardware and the virtual machine software are established in the virtual machine, the virtual machine containing the virtual machine hardware and the virtual machine software is saved to generate a virtual machine file. In the embodiment of the application, based on the collected software and hardware configuration and software dependence required by the construction environment, configuration steps such as hardware configuration, software dependence and the like in the construction environment construction process are integrated into a self-defined construction environment construction system in a self-defined configuration file mode, so that a virtual machine file containing the construction environment can be conveniently constructed on the basis of virtualization technology, and the virtual machine file can be conveniently subjected to cross-machine seamless migration. When a set of new construction environment is needed, the manufactured virtual machine file is copied to a new physical machine, and the construction work of the construction environment is not needed to be carried out once again. As the finally manufactured virtual machine file without any external dependence is the same as the finally manufactured virtual machine file, the consistency of the constructed environment formed after the virtual machine is operated is naturally ensured as long as the virtual machine file is ensured to be consistent. Therefore, the construction environment obtained by the method can ensure that all the construction environments are completely consistent, the construction efficiency of the construction environment can be greatly improved, the consistency of all the construction environments is ensured to the maximum extent, and stable infrastructure support is provided for the normal operation of the continuous delivery system.
In an exemplary embodiment, as shown in fig. 5, the method for generating a virtual machine file based on a build environment may further include: steps S50-S51, wherein:
step S50, after the virtual machine completes the creation of the virtual machine hardware and the virtual machine software, running a preset system instruction to obtain the software-dependent version information of the construction environment; step S51, comparing the version information with the software dependency information in the configuration file, and determining whether the build environment is correct according to the comparison result.
Specifically, after the virtual machine hardware and the virtual machine software are created in the virtual machine, the constructed construction environment may be verified to verify whether the construction environment is correct.
As an example, a system command such as python-version, sw _ vers, etc. may be run in the virtual machine to obtain version information of installed software dependencies, and after obtaining the version information of the software dependencies, compare the version information with the software dependency information in the initial configuration file, and if the version information of the software dependencies is completely consistent with the software dependency information in the initial configuration file, it is indicated that the build environment is correct. Otherwise, the construction environment is not expected to be built again.
According to the embodiment, the constructed environment is verified after the virtual machine hardware and the virtual machine software are established, so that whether the constructed environment is correct or not can be found in time.
Fig. 6 is a program module diagram of an embodiment of a virtual machine file generation apparatus 60 based on a build environment according to the present invention.
In this embodiment, the virtual machine file generation apparatus 60 based on the build environment includes a series of computer program instructions stored on a memory, and when the computer program instructions are executed by a processor, the virtual machine file generation function based on the build environment according to the embodiments of the present application can be implemented. In some embodiments, the build environment based virtual machine file generation apparatus 60 may be divided into one or more modules based on the particular operations implemented by the portions of the computer program instructions. For example, in fig. 6, the virtual machine file generation apparatus 60 based on the build environment may be divided into an acquisition module 61, a generation module 62, a creation module 63, and a saving module 64. Wherein:
the acquisition module 61 is used for acquiring software and hardware configuration and software dependence required by the built construction environment;
a generating module 62, configured to generate a configuration file in a preset format according to the software and hardware configuration and the software dependency;
a creating module 63, configured to create a virtual machine, and create virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file;
the saving module 64 is configured to save the virtual machine including the virtual machine hardware and the virtual machine software after the virtual machine completes the creation of the virtual machine hardware and the virtual machine software, so as to generate a virtual machine file.
In an exemplary embodiment, the creating module 63 is further configured to parse the configuration file to obtain software and hardware configuration information and software dependency information; and creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependence information in the virtual machine by using a preset script according to the software and hardware configuration information and the software dependence information.
In an exemplary embodiment, the creating module 63 is further configured to invoke a preset first interface in the virtual machine by using the script according to hardware configuration information in the software and hardware configuration information to simulate virtual machine hardware corresponding to the hardware configuration information; and calling a preset second interface by using the script in the virtual machine according to software configuration information in the software and hardware configuration information to realize the installation of an operating system of a version corresponding to the software configuration information, and calling a preset third interface by using the script in the operating system according to the software dependency information to realize the installation of software corresponding to the software dependency information, so as to realize the creation of the virtual machine software in the virtual machine.
In an exemplary embodiment, the configuration file includes hardware configuration information, multiple types of operating system information, and software dependency information corresponding to each operating system, and the creating module 63 is further configured to create virtual machine hardware and virtual machine software corresponding to each operating system in the virtual machine according to the hardware configuration information, the multiple types of operating system information, and the software dependency information corresponding to each operating system in the configuration file.
The saving module 64 is further configured to, after completing the virtual machine hardware and the virtual machine software corresponding to each operating system in the virtual machine, respectively save the virtual machine including the virtual machine hardware and the virtual machine software corresponding to different operating systems, so as to obtain virtual machine files corresponding to different operating systems.
In an exemplary embodiment, the virtual machine file generation apparatus 60 based on the build environment further includes a naming module.
And the naming module is used for naming the generated virtual machine files of different operating systems according to the naming information.
In an exemplary embodiment, the virtual machine file generation apparatus 60 based on the build environment further includes a run module and a comparison module.
The running module is used for running a preset system instruction after the virtual machine hardware and the virtual machine software are established in the virtual machine so as to obtain the software-dependent version information of the construction environment.
And the comparison module is used for comparing the version information with the software dependence information in the configuration file and determining whether the construction environment is correct or not according to a comparison result.
In an exemplary embodiment, the build environment is a Unity build environment or a Java build environment.
In the embodiment of the application, the software and hardware configuration and the software dependence required by the built construction environment are collected; generating a configuration file with a preset format according to the software and hardware configuration and the software dependence; creating a virtual machine, and creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file; after the virtual machine hardware and the virtual machine software are established in the virtual machine, the virtual machine containing the virtual machine hardware and the virtual machine software is saved to generate a virtual machine file. In the embodiment of the application, based on the collected software and hardware configuration and software dependence required by the construction environment, configuration steps such as hardware configuration, software dependence and the like in the construction environment construction process are integrated into a self-defined construction environment construction system in a self-defined configuration file mode, so that a virtual machine file containing the construction environment can be conveniently constructed on the basis of virtualization technology, and the virtual machine file can be conveniently subjected to cross-machine seamless migration. When a set of new construction environment is needed, the manufactured virtual machine file is copied to a new physical machine, and the construction work of the construction environment is not needed to be carried out once again. As the finally manufactured virtual machine file without any external dependence is the same as the finally manufactured virtual machine file, the consistency of the constructed environment formed after the virtual machine is operated is naturally ensured as long as the virtual machine file is ensured to be consistent. Therefore, the construction environment obtained by the method can ensure that all the construction environments are completely consistent, the construction efficiency of the construction environment can be greatly improved, the consistency of all the construction environments is ensured to the maximum extent, and stable infrastructure support is provided for the normal operation of the continuous delivery system.
Fig. 7 schematically shows a hardware architecture diagram of a computer device 7 adapted to implement the virtual machine file generation method based on the build environment according to an embodiment of the present application. In the present embodiment, the computer device 7 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a command set or stored in advance. For example, the server may be a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster composed of a plurality of servers). As shown in fig. 7, the computer device 7 includes at least, but is not limited to: the memory 120, processor 121, and network interface 123 may be communicatively linked to each other via a system bus. Wherein:
the memory 120 includes at least one type of computer-readable storage medium, which may be volatile or non-volatile, and particularly, includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 120 may be an internal storage module of the computer device 7, such as a hard disk or a memory of the computer device 7. In other embodiments, the memory 120 may also be an external storage device of the computer device 7, such as a plug-in hard disk provided on the computer device 7, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Of course, the memory 120 may also comprise both an internal memory module of the computer device 7 and an external memory device thereof. In this embodiment, the memory 120 is generally used for storing an operating system installed in the computer device 7 and various types of application software, such as program codes of a virtual machine file generation method based on a build environment. In addition, the memory 120 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 121 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 121 is generally used for controlling the overall operation of the computer device 7, such as performing control and processing related to data interaction or communication with the computer device 7. In this embodiment, the processor 121 is configured to execute the program code stored in the memory 120 or process data.
Network interface 123 may comprise a wireless network interface or a wired network interface, with network interface 123 typically being used to establish communication links between computer device 7 and other computer devices. For example, the network interface 123 is used to connect the computer device 7 with an external terminal via a network, establish a data transmission channel and a communication link between the computer device 7 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth (Bluetooth), or Wi-Fi.
It is noted that FIG. 7 only shows a computer device having components 120-122, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
In this embodiment, the method for generating a virtual machine file based on a build environment stored in the memory 120 may be divided into one or more program modules and executed by one or more processors (in this embodiment, the processor 121) to complete the present application.
The embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the virtual machine file generation method based on the build environment in the embodiment.
In this embodiment, the computer-readable storage medium includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the computer readable storage medium may be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. In other embodiments, the computer readable storage medium may be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device. Of course, the computer-readable storage medium may also include both internal and external storage devices of the computer device. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various types of application software installed in a computer device, for example, the program code of the virtual machine file generation method based on the build environment in the embodiment, and the like. Further, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on at least two network units. Some or all of the modules can be screened out according to actual needs to achieve the purpose of the scheme of the embodiment of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a general hardware platform, and certainly can also be implemented by hardware. It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a computer readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-only memory (ROM), a Random Access Memory (RAM), or the like.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A virtual machine file generation method based on a construction environment is characterized by comprising the following steps:
acquiring software and hardware configuration and software dependence required by the built construction environment;
generating a configuration file with a preset format according to the software and hardware configuration and the software dependence;
creating a virtual machine, and creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file;
after the virtual machine hardware and the virtual machine software are established in the virtual machine, the virtual machine containing the virtual machine hardware and the virtual machine software is saved to generate a virtual machine file.
2. The method for generating the virtual machine file based on the construction environment according to claim 1, wherein the creating the virtual machine hardware and the virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file comprises:
analyzing the configuration file to obtain software and hardware configuration information and software dependence information;
and creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependence information in the virtual machine by using a preset script according to the software and hardware configuration information and the software dependence information.
3. The method for generating the virtual machine file based on the build environment according to claim 2, wherein the creating, in the virtual machine, the virtual machine hardware and the virtual machine software corresponding to the software and hardware configuration information and the software dependency information using a preset script according to the software and hardware configuration information and the software dependency information includes:
calling a preset first interface in the virtual machine by using the script according to hardware configuration information in the software and hardware configuration information to simulate virtual machine hardware corresponding to the hardware configuration information;
and calling a preset second interface by using the script in the virtual machine according to software configuration information in the software and hardware configuration information to realize the installation of an operating system of a version corresponding to the software configuration information, and calling a preset third interface by using the script in the operating system according to the software dependency information to realize the installation of software corresponding to the software dependency information, so as to realize the creation of the virtual machine software in the virtual machine.
4. The method according to claim 1, wherein the configuration file includes hardware configuration information, multiple types of operating system information, and software dependency information corresponding to each operating system, and the creating of the virtual machine hardware and the virtual machine software in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file includes:
respectively creating virtual machine hardware and virtual machine software corresponding to each operating system in the virtual machine according to hardware configuration information, multiple types of operating system information and software dependence information corresponding to each operating system in the configuration file;
after the virtual machine hardware and the virtual machine software are created in the virtual machine, storing the virtual machine including the virtual machine hardware and the virtual machine software to generate a virtual machine file includes:
after the virtual machine hardware and the virtual machine software corresponding to each operating system are finished in the virtual machine, respectively storing the virtual machines containing the virtual machine hardware and the virtual machine software corresponding to different operating systems to obtain virtual machine files corresponding to different operating systems.
5. The method for generating the virtual machine file based on the build environment according to claim 4, wherein the configuration file further includes naming information of the virtual machine file to be generated, and the method for generating the virtual machine file based on the build environment further includes:
and naming the generated virtual machine files of different operating systems according to the naming information.
6. The virtual machine file generation method based on the build environment according to any one of claims 1 to 5, further comprising:
after the virtual machine hardware and the virtual machine software are established in the virtual machine, running a preset system instruction to acquire the software-dependent version information of the construction environment;
and comparing the version information with the software dependence information in the configuration file, and determining whether the construction environment is correct according to a comparison result.
7. The method according to claim 1, wherein the build environment is a Unity build environment or a Java build environment.
8. A virtual machine file generation apparatus based on a build environment, comprising:
the acquisition module is used for acquiring software and hardware configuration and software dependence required by the built construction environment;
the generating module is used for generating a configuration file in a preset format according to the software and hardware configuration and the software dependence;
the creating module is used for creating a virtual machine and creating virtual machine hardware and virtual machine software corresponding to the software and hardware configuration information and the software dependency information in the virtual machine according to the software and hardware configuration information and the software dependency information in the configuration file;
and the storage module is used for storing the virtual machine containing the virtual machine hardware and the virtual machine software after the virtual machine completes the creation of the virtual machine hardware and the virtual machine software so as to generate a virtual machine file.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the build environment based virtual machine file generation method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program when executed by a processor implements the steps of the build environment based virtual machine file generation method of any of claims 1 to 7.
CN202110013164.8A 2021-01-06 2021-01-06 Virtual machine file generation method and device based on construction environment Pending CN112698918A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110013164.8A CN112698918A (en) 2021-01-06 2021-01-06 Virtual machine file generation method and device based on construction environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110013164.8A CN112698918A (en) 2021-01-06 2021-01-06 Virtual machine file generation method and device based on construction environment

Publications (1)

Publication Number Publication Date
CN112698918A true CN112698918A (en) 2021-04-23

Family

ID=75514877

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110013164.8A Pending CN112698918A (en) 2021-01-06 2021-01-06 Virtual machine file generation method and device based on construction environment

Country Status (1)

Country Link
CN (1) CN112698918A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8219653B1 (en) * 2008-09-23 2012-07-10 Gogrid, LLC System and method for adapting a system configuration of a first computer system for hosting on a second computer system
CN103970908A (en) * 2014-05-28 2014-08-06 浪潮电子信息产业股份有限公司 Virtual machine template IVF storage method
CN104699508A (en) * 2015-03-25 2015-06-10 南京大学 System and method for quickly arranging and updating virtual environment in cloud computing platform
CN105573830A (en) * 2014-10-09 2016-05-11 中国银联股份有限公司 Virtual machine migration method
CN111459606A (en) * 2020-03-03 2020-07-28 山东汇贸电子口岸有限公司 Method for quickly creating virtual machine under virtualization and server

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8219653B1 (en) * 2008-09-23 2012-07-10 Gogrid, LLC System and method for adapting a system configuration of a first computer system for hosting on a second computer system
CN103970908A (en) * 2014-05-28 2014-08-06 浪潮电子信息产业股份有限公司 Virtual machine template IVF storage method
CN105573830A (en) * 2014-10-09 2016-05-11 中国银联股份有限公司 Virtual machine migration method
CN104699508A (en) * 2015-03-25 2015-06-10 南京大学 System and method for quickly arranging and updating virtual environment in cloud computing platform
CN111459606A (en) * 2020-03-03 2020-07-28 山东汇贸电子口岸有限公司 Method for quickly creating virtual machine under virtualization and server

Similar Documents

Publication Publication Date Title
CN110928529B (en) Method and system for assisting operator development
CN103812948B (en) Operation system of smart phone high in the clouds interacts custom-built system and method
CN102520972B (en) Video game development system and method thereof
WO2017185606A1 (en) Overlay mechanism-based apk development method and system
CN106648826B (en) For the method and apparatus of thermophoresis virtual machine
US20100281463A1 (en) XML based scripting framework, and methods of providing automated interactions with remote systems
CN112861057A (en) Page rendering method, device and equipment based on small program and storage medium
CN110673923A (en) XWIKI system configuration method, system and computer equipment
CN112765023A (en) Test case generation method and device
CN113805882A (en) Method and device for developing application program, electronic equipment and storage medium
CN111068328A (en) Game advertisement configuration table generation method, terminal device and medium
CN111338925A (en) Applet test method, device and system, electronic equipment and storage medium
CN113505082B (en) Application program testing method and device
CN111414391A (en) Method and system for accessing multiple data sources
WO2020199597A1 (en) Blockchain node management agent service installation method, electronic apparatus and storage medium
CN115291946A (en) Hongmong system transplanting method, device, electronic equipment and readable medium
CN114048415A (en) Form generation method and device, electronic equipment and computer readable storage medium
US10394529B2 (en) Development platform of mobile native applications
US20170052765A1 (en) Method and system for creating app
CN112068879A (en) Method and device for constructing client application development framework based on configuration
CN112685040A (en) Method, device, equipment and storage medium for generating interface file in android system
CN112235132A (en) Method, device, medium and server for dynamically configuring service
CN112162822A (en) Mirror image construction method, device, equipment and readable storage medium
CN110806891A (en) Method and device for generating software version of embedded equipment
CN103729202A (en) DSP reliable on-line FLASH programming method based on GEL script

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