WO2022134918A1 - 虚拟机属性变更方法和装置、存储介质和电子装置 - Google Patents

虚拟机属性变更方法和装置、存储介质和电子装置 Download PDF

Info

Publication number
WO2022134918A1
WO2022134918A1 PCT/CN2021/130225 CN2021130225W WO2022134918A1 WO 2022134918 A1 WO2022134918 A1 WO 2022134918A1 CN 2021130225 W CN2021130225 W CN 2021130225W WO 2022134918 A1 WO2022134918 A1 WO 2022134918A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
attribute
shared directory
configuration file
access
Prior art date
Application number
PCT/CN2021/130225
Other languages
English (en)
French (fr)
Inventor
张宇
孙广昆
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2022134918A1 publication Critical patent/WO2022134918A1/zh

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/445Program loading or initiating
    • 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/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • 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
    • 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

Definitions

  • the embodiments of the present application relate to the field of communications technologies, and in particular, to a method and device for changing attributes of a virtual machine, a storage medium, and an electronic device.
  • An embodiment of the present application provides a method for changing attributes of a virtual machine, including: creating a shared directory on a host where the virtual machine is located, wherein the shared directory records an attribute configuration file of the virtual machine; When the virtual machine is started, control the virtual machine to access the attribute configuration file in the shared directory; modify the attribute data in the virtual machine according to the attribute configuration file to obtain the virtual machine with the changed attributes .
  • An embodiment of the present application further provides an apparatus for changing attributes of a virtual machine, including: a creation unit configured to create a shared directory on a host where the virtual machine is located, wherein the shared directory records the information of the virtual machine an attribute configuration file; a control unit, configured to control the virtual machine to access the attribute configuration file in the shared directory when the virtual machine is started; a modification unit, configured to modify the attribute configuration file according to the attribute configuration file The attribute data in the virtual machine obtains the virtual machine whose attributes are changed.
  • Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, wherein the computer program is configured to execute the virtual machine attribute changing method when running.
  • Embodiments of the present application further provide an electronic device, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute the method for changing a virtual machine attribute.
  • FIG. 1 is a schematic diagram of a hardware environment of a method for changing a virtual machine attribute according to an embodiment of the present application
  • FIG. 2 is a flowchart of a method for changing a virtual machine attribute according to an embodiment of the present application
  • FIG. 3 is a system structural block diagram of a method for changing a virtual machine attribute according to an embodiment of the present application
  • FIG. 4 is a flowchart of a method for changing a virtual machine attribute according to an embodiment of the present application
  • FIG. 5 is a structural diagram of an apparatus for changing an attribute of a virtual machine according to an embodiment of the present application.
  • Embodiments of the present application provide a method and device for changing attributes of a virtual machine, a storage medium, and an electronic device, so as to at least solve the problem of low efficiency of virtual machine attribute configuration.
  • FIG. 1 is a hardware structural block diagram of a mobile terminal according to a method for changing a virtual machine attribute provided by an embodiment of the present application.
  • the mobile terminal may include one or more (only one is shown in FIG. 1 ) processor 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned mobile terminal may also include a transmission device 106 and an input and output device 108 for communication functions.
  • FIG. 1 is only a schematic diagram, which does not limit the structure of the above-mentioned mobile terminal.
  • the mobile terminal may also include more or fewer components than those shown in FIG. 1 , or have a different configuration than that shown in FIG. 1 .
  • the memory 104 may be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the virtual machine attribute changing method in the embodiments of the present application. Executing various functional applications and data processing implements the above-mentioned methods.
  • Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
  • the memory 104 may further include memory located remotely from the processor 102, and these remote memories may be connected to the mobile terminal through a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
  • Transmission means 106 are used to receive or transmit data via a network.
  • the specific example of the above-mentioned network may include a wireless network provided by a communication provider of the mobile terminal.
  • the transmission device 106 includes a network adapter (Network Interface Controller, NIC for short), which can be connected to other network devices through a base station so as to communicate with the Internet.
  • NIC Network Interface Controller
  • the transmission device 106 may be a radio frequency (Radio Frequency, RF for short) module, which is used to communicate with the Internet in a wireless manner.
  • RF Radio Frequency
  • This embodiment provides a method for changing attributes of a virtual machine, as shown in FIG. 2 , including the following steps:
  • Step S202 creating a shared directory on the host where the virtual machine is located, wherein the shared directory records an attribute configuration file of the virtual machine;
  • Step S204 when the virtual machine is started, control the virtual machine to access the attribute configuration file in the shared directory;
  • Step S206 modify the attribute data in the virtual machine according to the attribute configuration file to obtain the virtual machine with the changed attributes.
  • a shared directory can be created, so that the virtual machine can automatically call the property configuration file in the shared directory to configure the properties of the virtual machine, and the effect of automatically configuring the properties of the virtual machine is realized. .
  • the shared directory can be called jointly by multiple virtual machines, the property configuration efficiency of the virtual machines can be improved. Solved the problem of inefficient configuration of properties of virtual machines.
  • creating a shared directory on the host where the virtual machine is located includes: creating different types of subdirectories in the shared directory, and different types of subdirectories are used to record different attribute configuration files; setting different types of subdirectories Different property profiles.
  • controlling the virtual machine to access the property configuration file in the shared directory includes: determining the property type to be changed by the virtual machine; controlling the virtual machine to access the property in the subdirectory matching the property type configuration file.
  • controlling the virtual machine to access the property configuration file in the shared directory includes: if the virtual machine includes multiple virtual machines, controlling the multiple virtual machines to access the same property configuration file; or , in the case that there are multiple virtual machines, control each virtual machine in the multiple virtual machines to access an attribute configuration file.
  • controlling the virtual machine to access the attribute configuration file in the shared directory includes: controlling the virtual machine to read data in the attribute configuration file; or, controlling the virtual machine to write to the attribute configuration file input data.
  • the method further includes: receiving a control instruction, where the control instruction is used to add/delete/check/modify the shared directory; and in response to the control instruction, execute the execution on the shared directory Add/Delete/Check/Modify operations.
  • the virtual machine in this embodiment of the present application may be a virtual machine running different systems.
  • running Microsoft system Android system
  • the virtual machine running the Android system is called an Android virtual machine, and the Android virtual machine is taken as an example for description.
  • the terminal where the Android virtual machine is located can be called the host.
  • create a shared directory on the host then, based on the existing configuration of the Android virtual machine (hereinafter referred to as virtual machine), add the relevant configuration of the host shared directory to the Android virtual machine configuration file; finally, start the Android virtual machine.
  • the Android virtual machine can automatically configure the Android system attributes by reading the content in the host shared directory, which can be implemented in the Android image. Therefore, all Android virtual machines created in batches based on this image have this function. The information has been modified, and the effect of batch modifying the attributes of the Android virtual machine has been realized.
  • the use of shared directories is flexible. Multiple virtual machines can be mounted to the same shared directory according to project needs, or each virtual machine can be mounted separately.
  • the mount permissions can be set to read-only, read-write, etc.
  • Figure 3 is a system structure diagram.
  • the virtual machine runs on the host; after the created virtual machine is installed on the Android operating system, the Android virtual machine realizes some functions of the mobile phone, such as screenshots, games, etc.; conf.xml represents the configuration file of the virtual machine ;
  • the shared directory is a directory on the host, which is mainly used to realize data interaction between the host and the virtual machine; /etc/init.sh inside the Android virtual machine is the script executed when the Android virtual machine starts.
  • Fig. 4 is a schematic flow chart of the principle of the system and method, and the specific contents are as follows:
  • S401 Create a shared directory on the host.
  • a series of subdirectories can be created in the shared directory to store the virtual machine's attribute configuration files.
  • the attribute values of different virtual machines can be kept different.
  • the configuration file conf.xml of the virtual machine adds a configuration related to the shared directory, indicating that the virtual machine has the ability to mount the shared directory of the host;
  • each virtual machine In the case where each virtual machine is mounted with an independent shared directory, the attribute configuration files of each virtual machine need to be added to each subdirectory under the host shared directory, and the mac address is used as the unique identifier, that is, the virtual machine under the host shared directory is named as the virtual machine.
  • the mac address of the network card of the machine is used as the subdirectory name, and the attribute configuration files of different virtual machines are stored in different subdirectories, so as to realize the one-to-one correspondence between the virtual machine and the attribute configuration file; for multiple virtual machines, a host shared directory is mounted together In this case, each virtual machine can read the general configuration file in the specified mount directory.
  • S404 Add the step of mounting the host shared directory in the Android startup script /etc/init.sh to ensure that the host shared directory is automatically mounted when the Android system starts, and can increase the timeout protection, that is, after the mounting fails
  • the virtual machine can still be started without affecting the use of users; in the case of failure, the attribute value of the Android virtual machine is not modified, and in the case of successful hanging, the attribute value of the Android virtual machine is modified.
  • S405 Add the step of reading the specified configuration file in the shared directory in the Android startup script /etc/init.sh, and write the attribute values in the configuration file into the Android system, which can increase parameter protection, that is, only when the read Set the attribute value when it is different from the current value to improve the use efficiency;
  • the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation.
  • the technical solution of the present application can be embodied in the form of a software product in essence or in a part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, CD-ROM), including several instructions to make a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) execute the methods of the various embodiments of the present application.
  • a storage medium such as ROM/RAM, magnetic disk, CD-ROM
  • This embodiment also provides an apparatus for changing a virtual machine attribute, which is used to implement the above embodiments and preferred implementations, and what has been described will not be repeated.
  • the term "module” may be a combination of software and/or hardware that implements a predetermined function.
  • the apparatus described in the following embodiments is preferably implemented in software, implementations in hardware, or a combination of software and hardware, are also possible and contemplated.
  • FIG. 5 is a structural block diagram of a virtual machine attribute changing apparatus according to an embodiment of the present application. As shown in FIG. 5 , the apparatus includes:
  • a creating unit 502 is configured to create a shared directory on the host where the virtual machine is located, wherein the shared directory records an attribute configuration file of the virtual machine;
  • control unit 504 configured to control the virtual machine to access the attribute configuration file in the shared directory when the virtual machine is started;
  • the modifying unit 506 is configured to modify the attribute data in the virtual machine according to the attribute configuration file, so as to obtain the virtual machine whose attributes are changed.
  • the above modules can be implemented by software or hardware, and the latter can be implemented in the following ways, but not limited to this: the above modules are all located in the same processor; or, the above modules can be combined in any combination The forms are located in different processors.
  • Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, wherein the computer program is configured to execute the steps in any one of the above method embodiments when running.
  • the above-mentioned computer-readable storage medium may include, but is not limited to, a USB flash drive, a read-only memory (Read-Only Memory, ROM for short), and a random access memory (Random Access Memory, RAM for short) , mobile hard disk, magnetic disk or CD-ROM and other media that can store computer programs.
  • a USB flash drive a read-only memory (Read-Only Memory, ROM for short)
  • a random access memory Random Access Memory, RAM for short
  • mobile hard disk magnetic disk or CD-ROM and other media that can store computer programs.
  • Embodiments of the present application further provide an electronic device, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
  • the above-mentioned electronic device may further include a transmission device and an input-output device, wherein the transmission device is connected to the above-mentioned processor, and the input-output device is connected to the above-mentioned processor.
  • modules or steps of the present application can be implemented by a general-purpose computing device, and they can be centralized on a single computing device, or distributed in a network composed of multiple computing devices
  • they can be implemented in program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, can be performed in a different order than shown here.
  • the described steps, or they are respectively made into individual integrated circuit modules, or a plurality of modules or steps in them are made into a single integrated circuit module to realize.
  • the present application is not limited to any particular combination of hardware and software.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例涉及通信技术领域,提供了一种虚拟机属性变更方法和装置、存储介质和电子装置,上述方法包括:在虚拟机所在的主机上创建共享目录,其中,共享目录中记录有虚拟机的属性配置文件;在虚拟机启动的情况下,控制虚拟机访问共享目录中的属性配置文件;根据属性配置文件,修改虚拟机中的属性数据,得到属性变更后的虚拟机。

Description

虚拟机属性变更方法和装置、存储介质和电子装置
相关申请的交叉引用
本申请基于申请号为“202011555643.4”、申请日为2020年12月24日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此以引入方式并入本申请。
技术领域
本申请实施例涉及通信技术领域,特别涉及一种虚拟机属性变更方法和装置、存储介质和电子装置。
背景技术
在创建虚拟机之后,通常需要根据虚拟机的实际应用场景,来配置虚拟机的属性,技术人员可以登录虚拟机,然后配置虚拟机的属性,然而,在虚拟机数量庞大的情况下,仅仅依靠一台一台的登录虚拟机来配置属性,配置虚拟机属性的效率很低。
发明内容
本申请的实施例提供了一种虚拟机属性变更方法,包括:在所述虚拟机所在的主机上创建共享目录,其中,所述共享目录中记录有所述虚拟机的属性配置文件;在所述虚拟机启动的情况下,控制所述虚拟机访问所述共享目录中的所述属性配置文件;根据所述属性配置文件,修改所述虚拟机中的属性数据,得到属性变更后的虚拟机。
本申请的实施例还提供了一种虚拟机属性变更装置,包括:创建单元,用于在所述虚拟机所在的主机上创建共享目录,其中,所述共享目录中记录有所述虚拟机的属性配置文件;控制单元,用于在所述虚拟机启动的情况下,控制所述虚拟机访问所述共享目录中的所述属性配置文件;修改单元,用于根据所述属性配置文件,修改所述虚拟机中的属性数据,得到属性变更后的虚拟机。
本申请的实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行所述虚拟机属性变更方法。
本申请的实施例还提供了一种电子装置,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器被设置为运行所述计算机程序以执行所述虚拟机属性变更方法。
附图说明
图1是根据本申请实施例的虚拟机属性变更方法的硬件环境示意图;
图2是根据本申请实施例的虚拟机属性变更方法的流程图;
图3是根据本申请实施例的虚拟机属性变更方法的系统结构框图;
图4是根据本申请实施例的虚拟机属性变更方法的流程图;
图5是根据本申请实施例的虚拟机属性变更装置的结构图。
具体实施方式
本申请实施例提供了一种虚拟机属性变更方法和装置、存储介质和电子装置,以至少解 决虚拟机属性配置效率低的问题。
需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。
本申请实施例中所提供的方法实施例可以在移动终端、计算机终端或者类似的运算装置中执行。以运行在移动终端上为例,图1是本申请实施例提供的的一种虚拟机属性变更方法的移动终端的硬件结构框图。如图1所示,移动终端可以包括一个或多个(图1中仅示出一个)处理器102(处理器102可以包括但不限于微处理器MCU或可编程逻辑器件FPGA等的处理装置)和用于存储数据的存储器104,其中,上述移动终端还可以包括用于通信功能的传输设备106以及输入输出设备108。本领域普通技术人员可以理解,图1所示的结构仅为示意,其并不对上述移动终端的结构造成限定。例如,移动终端还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。
存储器104可用于存储计算机程序,例如,应用软件的软件程序以及模块,如本申请实施例中的虚拟机属性变更方法对应的计算机程序,处理器102通过运行存储在存储器104内的计算机程序,从而执行各种功能应用以及数据处理,即实现上述的方法。存储器104可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器104可进一步包括相对于处理器102远程设置的存储器,这些远程存储器可以通过网络连接至移动终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
传输装置106用于经由一个网络接收或者发送数据。上述的网络具体实例可包括移动终端的通信供应商提供的无线网络。
在一个实施例中,传输装置106包括一个网络适配器(Network Interface Controller,简称为NIC),其可通过基站与其他网络设备相连从而可与互联网进行通讯。
在一个实施例中,传输装置106可以为射频(Radio Frequency,简称为RF)模块,其用于通过无线方式与互联网进行通讯。
在本实施例中提供了一种虚拟机属性变更方法,如图2所示,包括如下步骤:
步骤S202,在虚拟机所在的主机上创建共享目录,其中,共享目录中记录有虚拟机的属性配置文件;
步骤S204,在虚拟机启动的情况下,控制虚拟机访问共享目录中的属性配置文件;
步骤S206,根据属性配置文件,修改虚拟机中的属性数据,得到属性变更后的虚拟机。
通过上述步骤,由于在配置虚拟机属性的过程中,可以通过创建共享目录,从而可以使虚拟机自动的调用共享目录下的属性配置文件配置虚拟机的属性,实现了自动配置虚拟机属性的效果。而且,由于共享目录可以多个虚拟机共同调用,因此,可以提高虚拟机的属性配置效率。解决了虚拟机的属性配置效率低的问题。
作为一种示例,在虚拟机所在的主机上创建共享目录,包括:在共享目录中创建不同类型的子目录,不同类型的子目录用于记录不同的属性配置文件;为不同类型的子目录设置不同的属性配置文件。
作为一种示例,在虚拟机启动的情况下,控制虚拟机访问共享目录中的属性配置文件,包括:确定虚拟机所要变更的属性类型;控制虚拟机访问与属性类型匹配的子目录下的属性 配置文件。
作为一种示例,在虚拟机启动的情况下,控制虚拟机访问共享目录中的属性配置文件,包括:在虚拟机包括多个的情况下,控制多个虚拟机访问同一个属性配置文件;或者,在虚拟机包括多个的情况下,控制多个虚拟机中的每一个虚拟机访问一个属性配置文件。
作为一种示例,在虚拟机启动的情况下,控制虚拟机访问共享目录中的属性配置文件,包括:控制虚拟机读取属性配置文件中的数据;或,控制虚拟机向属性配置文件中写入数据。
作为一种示例,在虚拟机所在的主机上创建共享目录之后,还包括:接收控制指令,其中,控制指令用于对共享目录进行增/删/查/改;响应控制指令,对共享目录执行增/删/查/改操作。
可选地,本申请实施例中的虚拟机可以为运行不同系统的虚拟机。例如,运行微软系统、安卓系统等系统。将运行安卓系统的虚拟机称为安卓虚拟机,以安卓虚拟机为例进行说明。
安卓虚拟机所在的终端可以称为主机。先在主机上创建共享目录;然后在安卓虚拟机(以下将虚拟机简称为虚机)现有配置的基础上,在安卓虚机配置文件中增加主机共享目录相关配置;最后在安卓虚机启动时挂载主机共享目录,安卓虚机通过读取主机共享目录中的内容,实现自动配置安卓系统属性,可做到安卓镜像中,因此基于此镜像批量创建的安卓虚机都具备该功能,属性信息均已经被修改,实现了批量修改安卓虚机的属性的效果。
共享目录的使用比较灵活,可以根据工程需要将多台虚机挂载同一共享目录,或者每台虚机单独挂载,挂载权限可设置为只读、读写等。
对于批量修改各个安卓虚机属性的情况,通过程序或者脚本修改主机共享目录下的属性配置文件,然后重启安卓虚机即可。该方法避免了一台一台修改虚机属性的繁琐操作,节约时间成本,提高使用效率。
图3为系统结构图。图3中,虚机运行在主机上;将创建好的虚机装上安卓操作系统后,安卓虚拟机就实现了手机的部分功能,如截图、游戏等;conf.xml表示虚拟机的配置文件;共享目录是主机上的一个目录,该目录主要用来实现主机与虚机之间的数据交互;安卓虚机内部的/etc/init.sh是安卓虚机启动时执行的脚本。
图4为本系统和方法原理流程示意图,具体内容如下:
S401:在主机上创建共享目录,为了满足用户对多样化、多规格安卓虚拟机的需求,共享目录下可创建一系列子目录存放虚机的属性配置文件,属性可以通过程序、脚本、或手动的方式设置,不同虚机的属性值可保持不同。
S402:虚机的配置文件conf.xml中增加共享目录相关配置,表示此虚机具有挂载主机共享目录的能力;
S403:对于每台虚机挂载独立的共享目录情况,需要在主机共享目录下的各个子目录中添加各个虚机的属性配置文件,使用mac地址作为唯一标识符,即主机共享目录下以虚机网卡的mac地址作为子目录名,不同子目录下存放不同虚机的属性配置文件,从而实现虚拟机和属性配置文件间的一一对应关系;对于多台虚机共同挂载一个主机共享目录的情况,各虚机读取指定挂载目录下的通用配置文件即可。
在启动安卓虚机时,S404:安卓启动脚本/etc/init.sh中增加挂载主机共享目录步骤,保证在安卓系统启动时自动挂载主机共享目录,可增加超时保护,即挂载失败后虚机依然能够启动,不影响用户使用;挂在失败的情况下,安卓虚机属性值不被修改,挂在成功的情况下, 安卓虚机属性值被修改。
S405:安卓启动脚本/etc/init.sh中增加读取共享目录下指定配置文件步骤,并将配置文件中的属性值写入到安卓系统中,可增加参数保护,即只有当读取到的属性值和当前值不同时才设置,提高使用效率;
S406:安卓系统启动完毕后,完成整个属性配置过程。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例的方法。
在本实施例中还提供了一种虚拟机属性变更装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。
图5是根据本申请实施例的虚拟机属性变更装置的结构框图,如图5所示,该装置包括:
创建单元502,用于在虚拟机所在的主机上创建共享目录,其中,共享目录中记录有虚拟机的属性配置文件;
控制单元504,用于在虚拟机启动的情况下,控制虚拟机访问共享目录中的属性配置文件;
修改单元506,用于根据属性配置文件,修改虚拟机中的属性数据,得到属性变更后的虚拟机。
需要说明的是,上述各个模块是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器中;或者,上述各个模块以任意组合的形式分别位于不同的处理器中。
本申请的实施例还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序,其中,该计算机程序被设置为运行时执行上述任一项方法实施例中的步骤。
在一个示例性实施例中,上述计算机可读存储介质可以包括但不限于:U盘、只读存储器(Read-Only Memory,简称:ROM)、随机存取存储器(Random Access Memory,简称:RAM)、移动硬盘、磁碟或者光盘等各种可以存储计算机程序的介质。
本申请的实施例还提供了一种电子装置,包括存储器和处理器,该存储器中存储有计算机程序,该处理器被设置为运行计算机程序以执行上述任一项方法实施例中的步骤。
在一个示例性实施例中,上述电子装置还可以包括传输设备以及输入输出设备,其中,该传输设备和上述处理器连接,该输入输出设备和上述处理器连接。
本实施例中的具体示例可以参考上述实施例及示例性实施方式中所描述的示例,本实施例在此不再赘述。
显然,本领域的技术人员应该明白,上述的本申请的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算 装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本申请不限制于任何特定的硬件和软件结合。
以上所述仅为本申请的优选实施例而已,并不用于限制本申请,对于本领域的技术人员来说,本申请可以有各种更改和变化。凡在本申请的原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。

Claims (10)

  1. 一种虚拟机属性变更方法,包括:
    在所述虚拟机所在的主机上创建共享目录,其中,所述共享目录中记录有所述虚拟机的属性配置文件;
    在所述虚拟机启动的情况下,控制所述虚拟机访问所述共享目录中的所述属性配置文件;
    根据所述属性配置文件,修改所述虚拟机中的属性数据,得到属性变更后的虚拟机。
  2. 根据权利要求1所述的方法,其中,所述在所述虚拟机所在的主机上创建共享目录,包括:
    在所述共享目录中创建不同类型的子目录,不同类型的所述子目录用于记录不同的所述属性配置文件;
    为不同类型的所述子目录设置不同的所述属性配置文件。
  3. 根据权利要求2所述的方法,其中,所述在所述虚拟机启动的情况下,控制所述虚拟机访问所述共享目录中的所述属性配置文件,包括:
    确定所述虚拟机所要变更的属性类型;
    控制所述虚拟机访问与所述属性类型匹配的所述子目录下的所述属性配置文件。
  4. 根据权利要求1或2所述的方法,其中,所述在所述虚拟机启动的情况下,控制所述虚拟机访问所述共享目录中的所述属性配置文件,包括:
    在所述虚拟机包括多个的情况下,控制多个所述虚拟机访问同一个所述属性配置文件;或者,
    在所述虚拟机包括多个的情况下,控制多个所述虚拟机中的每一个虚拟机访问一个所述属性配置文件。
  5. 根据权利要求1或2所述的方法,其中,所述在所述虚拟机启动的情况下,控制所述虚拟机访问所述共享目录中的所述属性配置文件,包括:
    控制所述虚拟机读取所述属性配置文件中的数据;或,
    控制所述虚拟机向所述属性配置文件中写入数据。
  6. 根据权利要求1至5任意一项所述的方法,其中,在所述在所述虚拟机所在的主机上创建所述共享目录之后,所述方法还包括:
    接收控制指令,其中,所述控制指令用于对所述共享目录进行增/删/查/改;
    响应所述控制指令,对所述共享目录执行所述增/删/查/改操作。
  7. 一种虚拟机属性变更装置,包括:
    创建单元,用于在所述虚拟机所在的主机上创建共享目录,其中,所述共享目录中记录有所述虚拟机的属性配置文件;
    控制单元,用于在所述虚拟机启动的情况下,控制所述虚拟机访问所述共享目录中的所述属性配置文件;
    修改单元,用于根据所述属性配置文件,修改所述虚拟机中的属性数据,得到属性变更 后的虚拟机。
  8. 根据权利要求7所述的装置,其中,所述创建单元包括:
    创建模块,用于在所述共享目录中创建不同类型的子目录,不同类型的所述子目录用于记录不同的所述属性配置文件;
    设置模块,用于为不同类型的所述子目录设置不同的所述属性配置文件。
  9. 一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,其中,所述计算机程序被处理器执行时实现所述权利要求1至6任一项中所述的虚拟机属性变更方法。
  10. 一种电子装置,包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现所述权利要求1至6任一项中所述的虚拟机属性变更方法。
PCT/CN2021/130225 2020-12-24 2021-11-12 虚拟机属性变更方法和装置、存储介质和电子装置 WO2022134918A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011555643.4A CN114675926A (zh) 2020-12-24 2020-12-24 虚拟机属性变更方法和装置、存储介质和电子装置
CN202011555643.4 2020-12-24

Publications (1)

Publication Number Publication Date
WO2022134918A1 true WO2022134918A1 (zh) 2022-06-30

Family

ID=82070875

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/130225 WO2022134918A1 (zh) 2020-12-24 2021-11-12 虚拟机属性变更方法和装置、存储介质和电子装置

Country Status (2)

Country Link
CN (1) CN114675926A (zh)
WO (1) WO2022134918A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024124912A1 (zh) * 2022-12-13 2024-06-20 苏州元脑智能科技有限公司 冗余固件的数据同步方法、装置及非易失性可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102404385A (zh) * 2011-10-25 2012-04-04 华中科技大学 面向高性能计算的虚拟集群部署系统和部署方法
CN102752137A (zh) * 2012-06-28 2012-10-24 用友软件股份有限公司 主动设置虚拟机网络参数的装置和方法
CN103856343A (zh) * 2012-12-05 2014-06-11 北京华胜天成科技股份有限公司 配置虚拟机网络信息的方法及系统
EP3707603A1 (en) * 2017-11-10 2020-09-16 Microsoft Technology Licensing, LLC Virtual machine server-side compute reconfiguration

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893115B (zh) * 2016-04-05 2019-08-20 上海携程商务有限公司 差异化部署虚拟机的方法和系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102404385A (zh) * 2011-10-25 2012-04-04 华中科技大学 面向高性能计算的虚拟集群部署系统和部署方法
CN102752137A (zh) * 2012-06-28 2012-10-24 用友软件股份有限公司 主动设置虚拟机网络参数的装置和方法
CN103856343A (zh) * 2012-12-05 2014-06-11 北京华胜天成科技股份有限公司 配置虚拟机网络信息的方法及系统
EP3707603A1 (en) * 2017-11-10 2020-09-16 Microsoft Technology Licensing, LLC Virtual machine server-side compute reconfiguration

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024124912A1 (zh) * 2022-12-13 2024-06-20 苏州元脑智能科技有限公司 冗余固件的数据同步方法、装置及非易失性可读存储介质

Also Published As

Publication number Publication date
CN114675926A (zh) 2022-06-28

Similar Documents

Publication Publication Date Title
US12035416B2 (en) ESIM card change method and related device
US11243792B2 (en) Image file conversion method and apparatus
US10970194B2 (en) Systems and methods for initializing test environments
WO2017185954A1 (zh) 一种实现usb设备管理的方法、主机和系统
CN111124286A (zh) 一种基于Libcloud的多云管理实现方法
CN113238835B (zh) 虚拟机配置方法、装置、服务器及系统
CN113572862A (zh) 一种集群部署方法、装置、电子设备及存储介质
CN111582824B (zh) 云资源同步方法、装置、设备及存储介质
WO2022134918A1 (zh) 虚拟机属性变更方法和装置、存储介质和电子装置
CN113391828A (zh) 实现系统盘raid划分并安装操作系统的方法和系统
CN115357198A (zh) 存储卷的挂载方法及装置、存储介质及电子设备
CN111142885A (zh) 一种eSIM设备管理方法、装置、设备及存储介质
CN116483468B (zh) 一种操作系统安装方法、装置、计算机设备及存储介质
CN111124890B (zh) 一种分布式数据库性能测试方法、系统、终端及存储介质
CN112099902A (zh) 虚拟机的网络适配器配置方法、装置、电子装置和存储介质
CN116700626A (zh) 资源的绑定方法、装置及电子设备
CN116450165A (zh) 一种快速搭建环境及部署程序的方法、系统、终端及存储介质
WO2021254280A1 (zh) 磁盘挂载方法、装置、存储介质以及电子装置
CN116341508A (zh) 报文模板的动态配置方法、装置、计算机设备及存储介质
WO2017096889A1 (zh) 系统升降级的方法和装置
CN112748943A (zh) 一种非智能交互电子白板的升级方法及升级系统
CN112527780A (zh) Redis集群的创建与管理方法、系统、计算机设备和存储介质
CN112417012A (zh) 数据处理方法及系统
CN112994907B (zh) 虚拟机的网络配置方法、装置、存储介质及设备
WO2024001569A1 (zh) 网络配置方法、装置以及存储介质、电子装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21908918

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 161123)

122 Ep: pct application non-entry in european phase

Ref document number: 21908918

Country of ref document: EP

Kind code of ref document: A1