CN118760448A - Method, device and application of automatic burning virtual machine system - Google Patents
Method, device and application of automatic burning virtual machine system Download PDFInfo
- Publication number
- CN118760448A CN118760448A CN202411247834.2A CN202411247834A CN118760448A CN 118760448 A CN118760448 A CN 118760448A CN 202411247834 A CN202411247834 A CN 202411247834A CN 118760448 A CN118760448 A CN 118760448A
- Authority
- CN
- China
- Prior art keywords
- virtual
- virtual machine
- hard disk
- machine system
- burning
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/61—Installation
- G06F8/63—Image based installation; Cloning; Build to order
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45562—Creating, deleting, cloning virtual machine instances
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
本发明提出了一种自动化刻录虚拟机系统的方法、装置及其应用,包括创建或下载并执行第一脚本,创建默认参数的虚拟机并设置两个虚拟光驱和两个虚拟硬盘,填入相应镜像文件并按需设定硬盘容量,设置启动顺序后激活虚拟机,虚拟机启动后进入 Linux 维护模式的命令行界面,创建或下载并执行第二脚本进行刻录,将待刻录虚拟机系统从第二个虚拟光驱刻录到第一个虚拟硬盘,刻录成功后关闭虚拟机。还包括文件检测、刻录前虚拟设备检测、执行第三脚本进行后续清理以及第四脚本实现虚拟机删除等步骤。具有兼容广泛、自动高效、成本低廉以及安全稳定等优点。
The present invention proposes a method, device and application of automatically burning a virtual machine system, including creating or downloading and executing a first script, creating a virtual machine with default parameters and setting two virtual optical drives and two virtual hard disks, filling in corresponding image files and setting hard disk capacity as needed, activating the virtual machine after setting the startup sequence, entering the command line interface of Linux maintenance mode after the virtual machine is started, creating or downloading and executing a second script for burning, burning the virtual machine system to be burned from the second virtual optical drive to the first virtual hard disk, and shutting down the virtual machine after the burning is successful. It also includes file detection, virtual device detection before burning, executing a third script for subsequent cleanup, and a fourth script to delete the virtual machine. It has the advantages of wide compatibility, automatic and efficient, low cost, and safe and stable.
Description
技术领域Technical Field
本发明涉及虚拟机技术领域,特别是一种涉及自动化刻录虚拟机系统的方法、装置及其应用。The present invention relates to the field of virtual machine technology, and in particular to a method, a device and an application thereof for an automated virtual machine burning system.
背景技术Background Art
在虚拟机技术中,虚拟机必须安装有与之对应的操作系统。然而,许多操作系统并不提供可直接安装的镜像文件,需要先将此类镜像文件刻录成具有启动引导功能的介质后,才能引导虚拟机系统的安装。In virtual machine technology, a virtual machine must be installed with a corresponding operating system. However, many operating systems do not provide image files that can be directly installed. Such image files need to be burned into a medium with a boot function before the installation of the virtual machine system can be booted.
目前常见的虚拟机系统刻录方法主要有以下几种:Currently, the common virtual machine system burning methods are mainly the following:
1.采用虚拟机管理系统自带的命令刻录至本机虚拟硬盘内,使用时读取本机虚拟硬盘引导虚拟机系统的安装。1. Use the commands provided by the virtual machine management system to burn it to the local virtual hard disk. When in use, read the local virtual hard disk to boot the installation of the virtual machine system.
2.采用第三方硬盘刻录工具刻录至本机虚拟硬盘内,使用时读取本机虚拟硬盘引导虚拟机系统的安装。2. Use a third-party hard disk burning tool to burn it to the local virtual hard disk. When in use, read the local virtual hard disk to boot the installation of the virtual machine system.
3.采用第三方光驱刻录软件刻录至外部光盘设备,使用时将光盘设备通过 CD/DVD 光驱连接至目标虚拟机管理系统 / 虚拟机管理软件后进行引导虚拟机系统的安装。3. Use third-party optical drive burning software to burn the disc to an external optical disc device. When using it, connect the optical disc device to the target virtual machine management system/virtual machine management software through the CD/DVD optical drive to boot the virtual machine system for installation.
4.采用第三方存储刻录软件刻录至外部存储设备,使用时将存储设备通过数据线或接口连接至目标虚拟机管理系统 / 虚拟机管理软件后进行引导虚拟机系统的安装。4. Use third-party storage burning software to burn to an external storage device. When in use, connect the storage device to the target virtual machine management system/virtual machine management software via a data cable or interface to boot the virtual machine system for installation.
但这些现有方法存在以下明显缺陷:However, these existing methods have the following obvious defects:
1.兼容差:采用自带的刻录命令只支持少数虚拟机管理系统,而其余的虚拟机管理系统以及绝大多数虚拟机管理软件则需依赖额外的一台计算机安装特定的第三方刻录工具进行刻录,通用性不高。1. Poor compatibility: The built-in burning command only supports a few virtual machine management systems, while the rest of the virtual machine management systems and most virtual machine management software require an additional computer to install specific third-party burning tools for burning, which is not very universal.
2.成本高:有的刻录方法需要准备一个符合足量、稳定、高速、安全等要求的 U 盘或 USB 驱动器或光盘或 SD 卡或移动硬盘等外部存储设备,甚至有的刻录工具需要付费使用,增加了支出成本;更换不同的平台往往会更换相应的工具和方法,增加了学习成本;很多方法只能在界面进行人工操作无法自动化,增加了时间成本。2. High cost: Some burning methods require the preparation of an external storage device such as a USB flash drive or USB drive or CD or SD card or mobile hard disk that meets the requirements of sufficient capacity, stability, high speed, and security. Some burning tools even require payment, which increases expenditure costs; changing to different platforms often requires changing corresponding tools and methods, increasing learning costs; many methods can only be manually operated in the interface and cannot be automated, which increases time costs.
3.风险大:环境影响外部设备的工作状态,高温、低温、断电、接触不良等都会导致刻录失败,错误的操作方式可能导致数据丢失、刻录异常等,低劣的存储芯片及材质可能导致不可控的后果,稳定性不强。3. High risk: The environment affects the working state of external devices. High temperature, low temperature, power failure, poor contact, etc. will cause burning failure. Wrong operation methods may cause data loss, burning abnormalities, etc. Poor storage chips and materials may lead to uncontrollable consequences and low stability.
4.效率低:很多刻录方法需要执行特定的操作步骤;有的方法还要人工校验核对是否刻录成功;一个存储设备只能用于一个虚拟机的安装,无法进行自动化和无法同时进行多台虚拟机系统的同步刻录;在刻录过程中需要在不同平台不断地进行存储设备的连接、识别、读取、移除等繁杂琐碎的操作等,效率低下。4. Low efficiency: Many burning methods require specific operating steps; some methods also require manual verification to check whether the burning is successful; a storage device can only be used to install a virtual machine, and it cannot be automated or synchronized with multiple virtual machine systems at the same time; during the burning process, it is necessary to continuously connect, identify, read, remove and other complicated and trivial operations of storage devices on different platforms, which is inefficient.
发明内容Summary of the invention
本发明实施例提供了一种自动化刻录虚拟机系统的方法、装置及其应用,针对目前技术存在的兼容差、成本高、风险大、效率低等问题。The embodiments of the present invention provide a method, device and application of an automatic burning virtual machine system, aiming at the problems of poor compatibility, high cost, high risk and low efficiency existing in the current technology.
本发明核心技术主要是利用 Linux 维护模式,通过一系列脚本实现虚拟机系统的自动化刻录及安装,包括创建虚拟机、设置虚拟设备、进入维护模式、进行刻录操作、清理及可选的虚拟机删除等步骤,解决了现有虚拟机刻录方法的诸多问题。The core technology of the present invention mainly utilizes the Linux maintenance mode to realize the automatic burning and installation of the virtual machine system through a series of scripts, including the steps of creating a virtual machine, setting up virtual devices, entering maintenance mode, performing burning operations, cleaning and optional virtual machine deletion, etc., which solves many problems of existing virtual machine burning methods.
第一方面,本发明提供了一种自动化刻录虚拟机系统的方法,所述方法包括以下步骤:In a first aspect, the present invention provides a method for automatically burning a virtual machine system, the method comprising the following steps:
S00、创建或下载并执行第一脚本;S00, creating or downloading and executing a first script;
S10、创建默认参数的虚拟机,并将虚拟光驱和虚拟硬盘的数量均设置为两个;S10, creating a virtual machine with default parameters, and setting the number of virtual CD-ROM drives and virtual hard disks to two;
S20、将待维护模式的Linux系统的镜像文件填入第一个虚拟光驱内,将待刻录虚拟机系统的镜像文件填入第二个虚拟光驱内,同时按需设定两个虚拟硬盘的容量;S20, filling the image file of the Linux system to be maintained into the first virtual CD-ROM drive, filling the image file of the virtual machine system to be burned into the second virtual CD-ROM drive, and setting the capacity of the two virtual hard disks as needed;
S30、设置启动顺序,按第一个虚拟光驱,第二个虚拟光驱,第一个虚拟硬盘以及第二个虚拟硬盘进行设置并激活虚拟机;S30, setting the boot sequence, setting and activating the virtual machine according to the first virtual CD-ROM drive, the second virtual CD-ROM drive, the first virtual hard disk and the second virtual hard disk;
S40、虚拟机启动后,进入Linux的维护模式的命令行界面;S40. After the virtual machine is started, enter the command line interface of Linux maintenance mode;
S50、创建或下载并执行第二脚本;S50, creating or downloading and executing a second script;
S60、使用刻录命令进行刻录,将待刻录虚拟机系统从第二个虚拟光驱刻录到第一个虚拟硬盘内;S60, using a burning command to burn the virtual machine system to be burned from the second virtual optical drive to the first virtual hard disk;
S70、刻录成功后关闭虚拟机。S70. After the burning is successful, shut down the virtual machine.
进一步地,S20步骤中,第一个虚拟硬盘的容量设置为待刻录虚拟机系统的镜像文件的两倍以上,第二个虚拟硬盘的容量设置为32GB以上。Furthermore, in step S20, the capacity of the first virtual hard disk is set to be more than twice the size of the image file of the virtual machine system to be burned, and the capacity of the second virtual hard disk is set to be more than 32 GB.
进一步地,S10步骤和S20步骤之间,进行文件检测,包括待刻录的虚拟机系统文件和带维护模式的 Linux 文件;若文件不存在,则从网络下载并解压。Furthermore, between step S10 and step S20, a file check is performed, including the virtual machine system file to be burned and the Linux file with maintenance mode; if the file does not exist, it is downloaded from the network and decompressed.
进一步地,S60步骤中,在刻录前先检测所有虚拟硬盘和虚拟光驱是否成功加载,且数量大于等于2;Furthermore, in step S60, before burning, it is first detected whether all virtual hard disks and virtual optical drives are successfully loaded, and the number is greater than or equal to 2;
若是,则自动匹配虚拟硬盘和虚拟光驱,根据容量和类型进行匹配;若否,则报错并退出刻录流程。If yes, the virtual hard disk and virtual optical drive will be automatically matched according to capacity and type; if not, an error message will be given and the burning process will be exited.
进一步地,还包括S80步骤,关闭虚拟机后,创建或下载并执行第三脚本;Furthermore, the method further includes step S80, after shutting down the virtual machine, creating or downloading and executing a third script;
S90步骤、删除所有虚拟光驱并重启虚拟机,以进入虚拟机系统安装界面,将第二虚拟硬盘作为系统的安装盘。In step S90, all virtual optical drives are deleted and the virtual machine is restarted to enter the virtual machine system installation interface, and the second virtual hard disk is used as the system installation disk.
进一步地,还包括第四脚本,该第四脚本通过响应于用户输入的虚拟机ID,删除对应的虚拟机,或响应于用户输入的全部删除指令,删除全部虚拟机。Furthermore, a fourth script is included, which deletes the corresponding virtual machine in response to the virtual machine ID input by the user, or deletes all virtual machines in response to the all-delete instruction input by the user.
进一步地,S00步骤中,临时文件存储服务器于局域网中,在该临时文件存储服务器上存储所有脚本和镜像文件。Furthermore, in step S00, a temporary file storage server is located in a local area network, and all scripts and image files are stored on the temporary file storage server.
第二方面,本发明提供了一种自动化刻录虚拟机系统的装置,包括:In a second aspect, the present invention provides a device for automatically burning a virtual machine system, comprising:
临时文件存储服务器模块,用于存储所有脚本和镜像文件;Temporary file storage server module, used to store all scripts and image files;
局域网模块,提供本地网络服务,用于临时文件存储服务器模块和虚拟机模块的数据交互;The LAN module provides local network services for data interaction between the temporary file storage server module and the virtual machine module;
虚拟机模块,用于创建默认参数的虚拟机,并将虚拟光驱和虚拟硬盘的数量均设置为两个;将待维护模式的Linux系统的镜像文件填入第一个虚拟光驱内,将待刻录虚拟机系统的镜像文件填入第二个虚拟光驱内,同时按需设定两个虚拟硬盘的容量;设置启动顺序,按第一个虚拟光驱,第二个虚拟光驱,第一个虚拟硬盘以及第二个虚拟硬盘进行设置并激活虚拟机;虚拟机启动后,进入Linux的维护模式的命令行界面;创建或下载并执行第二脚本;使用刻录命令进行刻录,将待刻录虚拟机系统从第二个虚拟光驱刻录到第一个虚拟硬盘内;刻录成功后关闭虚拟机。The virtual machine module is used to create a virtual machine with default parameters and set the number of virtual optical drives and virtual hard disks to two; fill the image file of the Linux system to be maintained in the first virtual optical drive, fill the image file of the virtual machine system to be burned in the second virtual optical drive, and set the capacity of the two virtual hard disks as needed; set the startup sequence, set and activate the virtual machine according to the first virtual optical drive, the second virtual optical drive, the first virtual hard disk and the second virtual hard disk; after the virtual machine is started, enter the command line interface of the Linux maintenance mode; create or download and execute the second script; use the burning command to burn, and burn the virtual machine system to be burned from the second virtual optical drive to the first virtual hard disk; and shut down the virtual machine after the burning is successful.
第三方面,本发明提供了一种电子装置,包括存储器和处理器,存储器中存储有计算机程序,处理器被设置为运行计算机程序以执行上述的自动化刻录虚拟机系统的方法。In a third aspect, the present invention provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the above-mentioned method of automatically burning a virtual machine system.
第四方面,本发明提供了一种可读存储介质,可读存储介质中存储有计算机程序,计算机程序包括用于控制过程以执行过程的程序代码,过程包括根据上述的自动化刻录虚拟机系统的方法。In a fourth aspect, the present invention provides a readable storage medium, in which a computer program is stored. The computer program includes a program code for controlling a process to execute the process. The process includes the method of automatically burning a virtual machine system according to the above-mentioned method.
本发明的主要贡献和创新点如下:The main contributions and innovations of the present invention are as follows:
一、兼容性提升1. Improved compatibility
现有技术中,采用自带的刻录命令只支持少数虚拟机管理系统,而其余的虚拟机管理系统以及绝大多数虚拟机管理软件则需依赖额外的一台计算机安装特定的第三方刻录工具进行刻录,通用性不高。本发明通过特定的脚本和流程,在 Proxmox VE 中实现虚拟机系统的刻录,不依赖特定的虚拟机管理系统或额外的计算机,兼容性大大提高。因此,目前主流的直接安装在主板上的虚拟机管理系统,如ProxmoxVE、VMwareEsxi、Unraid等,安装于宿主主机的虚拟机管理软件,如ParallelsDesktop、VMwareFusion、VMwareWorkstationPlayer、OracleVMVirtualBox等,均可以采用本发明的方法,特定平台只需要针对性修整,基本步骤一致,不限于特定平台及特定设备,通用性极强。In the prior art, the use of built-in burning commands only supports a few virtual machine management systems, while the remaining virtual machine management systems and most virtual machine management software need to rely on an additional computer to install a specific third-party burning tool for burning, and the versatility is not high. The present invention implements the burning of virtual machine systems in Proxmox VE through specific scripts and processes, does not rely on specific virtual machine management systems or additional computers, and greatly improves compatibility. Therefore, the current mainstream virtual machine management systems directly installed on the motherboard, such as Proxmox VE, VMware Esxi, Unraid, etc., and virtual machine management software installed on the host host, such as Parallels Desktop, VMware Fusion, VMware Workstation Player, Oracle VM Virtual Box, etc., can all adopt the method of the present invention. The specific platform only needs targeted trimming, the basic steps are consistent, and it is not limited to specific platforms and specific devices, and it has strong versatility.
二、成本降低2. Cost reduction
现有技术中,有的刻录方法需要准备外部存储设备,增加了支出成本;更换不同平台往往会更换相应工具和方法,增加了学习成本;很多方法只能在界面进行人工操作无法自动化,增加了时间成本。本发明无需额外的外部存储设备,通过局域网内的临时文件存储服务器即可获取所需的脚本和镜像文件,减少了支出成本。同时,整个刻录和安装流程自动化程度高,降低了学习成本和时间成本。使用后的各种文件及启动虚拟磁盘可以直接删除,节省了本机硬盘的容量。达到了瘦身及无痕的效果。In the prior art, some burning methods require the preparation of external storage devices, which increases the expenditure cost; changing different platforms often requires the replacement of corresponding tools and methods, which increases the learning cost; many methods can only be operated manually in the interface and cannot be automated, which increases the time cost. The present invention does not require additional external storage devices, and the required scripts and image files can be obtained through the temporary file storage server in the local area network, reducing the expenditure cost. At the same time, the entire burning and installation process has a high degree of automation, which reduces the learning cost and time cost. Various files and startup virtual disks can be deleted directly after use, saving the capacity of the local hard disk. The effect of slimming and leaving no trace is achieved.
三、风险减小3. Risk reduction
现有技术中,环境影响外部设备的工作状态,高温、低温、断电、接触不良等都会导致刻录失败,错误的操作方式可能导致数据丢失、刻录异常等,低劣的存储芯片及材质可能导致不可控的后果,稳定性不强。本发明在虚拟机内部进行刻录操作,不受外部环境因素的影响,降低了刻录失败的风险。同时,通过严格的检测和匹配步骤,确保刻录过程的准确性和稳定性。In the prior art, the environment affects the working state of external devices. High temperature, low temperature, power failure, poor contact, etc. can cause burning failure. Wrong operation methods may cause data loss, burning abnormalities, etc. Poor storage chips and materials may lead to uncontrollable consequences and low stability. The present invention performs burning operations inside the virtual machine, which is not affected by external environmental factors and reduces the risk of burning failure. At the same time, through strict detection and matching steps, the accuracy and stability of the burning process are ensured.
四、效率提高4. Improved efficiency
现有技术中,很多刻录方法需要执行特定的操作步骤;有的方法还要人工校验核对是否刻录成功;一个存储设备只能用于一个虚拟机的安装,无法进行自动化和无法同时进行多台虚拟机系统的同步刻录;在刻录过程中需要在不同平台不断地进行存储设备的连接、识别、读取、移除等繁杂琐碎的操作等,效率低下。本发明通过自动化的脚本执行,除进入Linux的维护模式需要人工选择和手动输入外,其他操作完全实行了自动化,无需进行人工干预和人工校对;无需频繁地将存储设备连接/移除操作;也不用一个存储设备只能连接一个虚拟机的限制;还避免了必须将存储设备清空并格式化特定格式,可以随意刻录任何系统,灵活自由;加之可同时进行多台虚拟机系统的同步刻录部署,效率更是比以往方式提升90%。In the prior art, many burning methods require specific operation steps; some methods also require manual verification to check whether the burning is successful; a storage device can only be used for the installation of a virtual machine, and it is impossible to automate and simultaneously burn multiple virtual machine systems; during the burning process, it is necessary to continuously perform complicated and trivial operations such as connecting, identifying, reading, and removing storage devices on different platforms, etc., which is inefficient. The present invention uses automated script execution, except for manual selection and manual input required to enter the maintenance mode of Linux, other operations are completely automated, without the need for manual intervention and manual proofreading; there is no need to frequently connect/remove storage devices; there is no restriction that a storage device can only be connected to one virtual machine; it also avoids the need to clear the storage device and format it in a specific format, and any system can be burned at will, which is flexible and free; in addition, it can simultaneously carry out synchronous burning deployment of multiple virtual machine systems, and the efficiency is increased by 90% compared with the previous method.
本发明的一个或多个实施例的细节在以下附图和描述中提出,以使本发明的其他特征、目的和优点更加简明易懂。The details of one or more embodiments of the invention are set forth in the following drawings and description so that other features, objects, and advantages of the invention are more readily apparent.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
此处所说明的附图用来提供对本发明的进一步理解,构成本发明的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
图1是根据本发明实施例的自动化刻录虚拟机系统的方法的流程图;FIG1 is a flow chart of a method for automatically burning a virtual machine system according to an embodiment of the present invention;
图2是根据本发明实施例的电子装置的硬件结构示意图。FIG. 2 is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention.
具体实施方式DETAILED DESCRIPTION
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书一个或多个实施例相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书一个或多个实施例的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
需要说明的是:在其他实施例中并不一定按照本说明书示出和描述的顺序来执行相应方法的步骤。在一些其他实施例中,其方法所包括的步骤可以比本说明书所描述的更多或更少。此外,本说明书中所描述的单个步骤,在其他实施例中可能被分解为多个步骤进行描述;而本说明书中所描述的多个步骤,在其他实施例中也可能被合并为单个步骤进行描述。It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or fewer steps than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.
实施例一Embodiment 1
本发明旨在提出了一种自动化刻录虚拟机系统的方法,通过Linux自带的维护模式实现,具体地,参考图1,以开源虚拟机管理系统ProxmoxVE中利用RockyLinux自动化刻录OpenWrt虚拟机系统,并临时部署了一个局域网脚本存储服务,使用时直接下载脚本为例:The present invention aims to propose a method for automatically burning a virtual machine system, which is implemented through the maintenance mode of Linux. Specifically, referring to FIG1 , the open source virtual machine management system ProxmoxVE uses RockyLinux to automatically burn an OpenWrt virtual machine system, and temporarily deploys a local area network script storage service, and directly downloads the script when using it.
第一步、在ProxmoxVE中创建或下载并执行如下脚本【s1_create.sh】实现自动化创建和设置虚拟机,s1_create.sh的脚本内容如下:The first step is to create or download and execute the following script [s1_create.sh] in ProxmoxVE to automatically create and set up virtual machines. The script content of s1_create.sh is as follows:
#!/bin/bash#!/bin/bash
#ScriptName:s1_create.sh#ScriptName:s1_create.sh
#Description:技术点第1步-用于PVE虚拟管理系统下虚拟机自动化创建和设置。#Description:Technical point Step 1 - Used for automatic creation and setting of virtual machines under PVE virtual management system.
#Author:Candy#Author:Candy
#Date:2024-08-06#Date:2024-08-06
##################################################################
#参数配置##Parameter Configuration#
##################################################################
readonlyVM_NAME="OpenWrt"readonlyVM_NAME="OpenWrt"
readonlyVM_CPU=1readonlyVM_CPU=1
readonlyVM_MEMORY=2048readonlyVM_MEMORY=2048
#用于刻录后引导安装的启动磁盘的容量大小。#The capacity of the boot disk used for booting and installation after burning.
readonlyVM_BOOT_DISK=5readonlyVM_BOOT_DISK=5
#用于虚拟机系统安装和使用的磁盘容量大小。#The disk capacity used for virtual machine system installation and use.
readonlyVM_HARD_DISK=16readonlyVM_HARD_DISK=16
aliasLOG='f(){echo[$(TZ=UTC-8date"+%H:%M:%S")]:$1;};f'aliasLOG='f(){echo[$(TZ=UTC-8date"+%H:%M:%S")]:$1;};f'
##################################################################
#操作步骤##Steps#
##################################################################
#一、检测文件#1. Detection File
LOG"========文件检测是否存在========"LOG"=========File check whether it exists========"
readonlyISO_PATH="/var/lib/vz/template/iso"readonlyISO_PATH="/var/lib/vz/template/iso"
LOG"本机文件保存路径:${ISO_PATH}。"LOG "Local file save path: ${ISO_PATH}."
#(1)检测待刻录的虚拟机系统的文件。#(1) Check the files of the virtual machine system to be burned.
readonlyBURN_SYSTEM_NAME="OpenWrt"readonlyBURN_SYSTEM_NAME="OpenWrt"
readonlyBURN_SYSTEM_FILE="openwrt-23.05.3-x86-64-generic-ext4-combined-efi.img"readonlyBURN_SYSTEM_FILE="openwrt-23.05.3-x86-64-generic-ext4-combined-efi.img"
readonlyBURN_SYSTEM_LINK="https://downloads.openwrt.org/releases/23.05.3/targets/x86/64/${BURN_SYSTEM_FILE}.gz"readonlyBURN_SYSTEM_LINK="https://downloads.openwrt.org/releases/23.05.3/targets/x86/64/${BURN_SYSTEM_FILE}.gz"
LOG"待刻录的虚拟机系统名称为:${BURN_SYSTEM_NAME}。"LOG"The name of the virtual machine system to be burned is: ${BURN_SYSTEM_NAME}."
LOG"待刻录的虚拟机系统文件为:${BURN_SYSTEM_FILE}。"LOG"The virtual machine system file to be burned is: ${BURN_SYSTEM_FILE}."
LOG"检测待刻录的虚拟机系统文件是否存在于本机中:"LOG"Check whether the virtual machine system files to be burned exist in this machine:"
if[-e"${ISO_PATH}/${BURN_SYSTEM_FILE}"];thenif[-e"${ISO_PATH}/${BURN_SYSTEM_FILE}"];then
LOG"待刻录的虚拟机系统文件存在,继续下一步。"LOG "The virtual machine system files to be burned exist, continue to the next step."
elseelse
LOG"待刻录的虚拟机系统文件不存在,将从网络下载。"LOG "The virtual machine system file to be burned does not exist and will be downloaded from the network."
wget-P${ISO_PATH}${BURN_SYSTEM_LINK}wget-P${ISO_PATH}${BURN_SYSTEM_LINK}
LOG"待刻录的虚拟机系统文件下载完毕。"LOG "The virtual machine system files to be burned have been downloaded."
LOG"待刻录的虚拟机系统文件开始解压。"LOG "The virtual machine system files to be burned are starting to be decompressed."
gzip-d${ISO_PATH}/${BURN_SYSTEM_FILE}.gzgzip-d${ISO_PATH}/${BURN_SYSTEM_FILE}.gz
LOG"待刻录的虚拟机系统文件解压完毕,继续下一步。"LOG "The virtual machine system files to be burned have been decompressed. Continue to the next step."
fifi
#(2)检测带维护模式的Linux文件。#(2)Detect Linux files with maintenance mode.
readonlyRESCUE_LINUX_NAME="RockyLinux"readonlyRESCUE_LINUX_NAME="RockyLinux"
readonlyRESCUE_LINUX_FILE="Rocky-9.4-x86_64-minimal.iso"readonlyRESCUE_LINUX_FILE="Rocky-9.4-x86_64-minimal.iso"
readonlyRESCUE_LINUX_LINK="https://download.rockylinux.org/pub/rocky/9/isos/x86_64/${RESCUE_LINUX_FILE}"readonlyRESCUE_LINUX_LINK="https://download.rockylinux.org/pub/rocky/9/isos/x86_64/${RESCUE_LINUX_FILE}"
LOG"带维护模式的Linux名称为:${RESCUE_LINUX_NAME}。"LOG"The name of the Linux with maintenance mode is: ${RESCUE_LINUX_NAME}."
LOG"带维护模式的Linux文件为:${RESCUE_LINUX_FILE}。"LOG"The Linux file with maintenance mode is: ${RESCUE_LINUX_FILE}."
LOG"检测带维护模式的Linux文件是否存在于本机中:"LOG"Check whether the Linux file with maintenance mode exists on this machine:"
if[-e"${ISO_PATH}/${RESCUE_LINUX_FILE}"];thenif[-e"${ISO_PATH}/${RESCUE_LINUX_FILE}"];then
LOG"带维护模式的Linux文件存在,继续下一步。"LOG "Linux file with maintenance mode exists, continue to the next step."
elseelse
LOG"带维护模式的Linux文件不存在,将从网络下载。"LOG "Linux with maintenance mode file does not exist, will be downloaded from the network."
wget-P${ISO_PATH}${RESCUE_LINUX_LINK}wget-P${ISO_PATH}${RESCUE_LINUX_LINK}
LOG"带维护模式的Linux文件下载完毕,继续下一步"LOG "Download of Linux file with maintenance mode completed, continue to the next step"
fifi
LOG"========文件检测完毕========"LOG"========File detection completed========"
#二、创建默认虚拟机#2. Create a default virtual machine
LOG"========虚拟机开始创建========"LOG"=========The virtual machine starts to be created========"
#(1)获取下一个可用的虚拟机ID。#(1) Get the next available virtual machine ID.
VM_ID=$(pveshget/cluster/nextid)VM_ID=$(pveshget/cluster/nextid)
echo"newVM${VM_ID}:-id${VM_ID}"echo "newVM${VM_ID}:-id${VM_ID}"
#(2).创建空白虚拟机。#(2). Create a blank virtual machine.
qmcreate${VM_ID}--name${VM_NAME}qmcreate${VM_ID}--name${VM_NAME}
echo"createVM${VM_ID}:-name${VM_NAME}"echo "createVM${VM_ID}:-name${VM_NAME}"
#(3)设置默认CPU。#(3)Set the default CPU.
qmset${VM_ID}--cpux86-64-v2-AES--cores${VM_CPU}--sockets${VM_CPU}qmset${VM_ID}--cpux86-64-v2-AES--cores${VM_CPU}--sockets${VM_CPU}
#(4)设置默认内存。#(4)Set the default memory.
qmset${VM_ID}--memory${VM_MEMORY}qmset${VM_ID}--memory${VM_MEMORY}
#(5)设置EFI硬盘。#(5) Set up the EFI hard disk.
qmset${VM_ID}--efidisk0local-lvm:0,efitype=4m,size=4M,pre-enrolled-keys=noqmset${VM_ID}--efidisk0local-lvm:0,efitype=4m,size=4M,pre-enrolled-keys=no
#(6)设置默认BIOS。#(6)Set the default BIOS.
qmset${VM_ID}--biosovmfqmset ${VM_ID} --biosovmf
#(7)设置默认机器类型。#(7)Set the default machine type.
qmset${VM_ID}--machineq35qmset ${VM_ID} --machineq35
#(8)设置SCSI控制器。#(8)Set up the SCSI controller.
qmset${VM_ID}--scsihwvirtio-scsi-singleqmset${VM_ID}--scsihwvirtio-scsi-single
#(9)设置网络。#(9) Set up the network.
qmset${VM_ID}--net0virtio,bridge=vmbr0,firewall=1qmset${VM_ID}--net0virtio,bridge=vmbr0,firewall=1
#(10)动态调整ThinPool,有版本需要设置。#(10) Dynamically adjust ThinPool. Some versions need to be set.
#lvmconfig--withcomments--typediffactivation/thin_pool_autoextend_threshold=80#lvmconfig--withcomments--typediffactivation/thin_pool_autoextend_threshold=80
#lvmconfig--withcomments--typediffactivation/thin_pool_autoextend_percent=20#lvmconfig--withcomments--typediffactivation/thin_pool_autoextend_percent=20
LOG"========虚拟机创建完毕========"LOG"=========Virtual machine creation completed========"
#三、关键设置点设置#3. Key setting point settings
LOG"========核心设置点开始设置========"LOG"=========Core setting point starts setting========"
#(1)创建并填入虚拟光驱1为待维护模式的Linux系统镜像。#(1) Create and fill in virtual CD-ROM drive 1 as the Linux system image in maintenance mode.
qmset${VM_ID}--ide0local:iso/Rocky-9.4-x86_64-minimal.iso,media=cdromqmset${VM_ID}--ide0local:iso/Rocky-9.4-x86_64-minimal.iso,media=cdrom
#(2)创建并填入虚拟光驱2为待刻录虚拟机系统镜像。#(2) Create and fill in virtual CD-ROM drive 2 as the virtual machine system image to be burned.
qmset${VM_ID}--ide1local:iso/openwrt-23.05.3-x86-64-generic-ext4-combined-efi.img,media=cdromqmset${VM_ID}--ide1local:iso/openwrt-23.05.3-x86-64-generic-ext4-combined-efi.img,media=cdrom
#(3)创建空白虚拟硬盘1用于存储虚拟机系统镜像文件的刻录数据。#(3) Create a blank virtual hard disk 1 to store the burning data of the virtual machine system image file.
qmset${VM_ID}--scsi0local-lvm:${VM_BOOT_DISK},iothread=1,size=${VM_BOOT_DISK}Gqmset${VM_ID}--scsi0local-lvm:${VM_BOOT_DISK},iothread=1,size=${VM_BOOT_DISK}G
#(4)创建空白虚拟硬盘1用于虚拟机系统的安装。#(4) Create a blank virtual hard disk 1 for installing the virtual machine system.
qmset${VM_ID}--scsi1local-lvm:${VM_HARD_DISK},iothread=1,size=${VM_HARD_DISK}Gqmset${VM_ID}--scsi1local-lvm:${VM_HARD_DISK},iothread=1,size=${VM_HARD_DISK}G
#(5)设置启动顺序(虚拟光驱1、虚拟光驱2、虚拟硬盘1、虚拟硬盘2)并激活虚拟设备。#(5) Set the boot order (virtual CD-ROM drive 1, virtual CD-ROM drive 2, virtual hard disk 1, virtual hard disk 2) and activate the virtual device.
qmset${VM_ID}--bootorder=ide0--bootdiskscsi0qmset${VM_ID}--bootorder=ide0--bootdiskscsi0
LOG"========核心设置点设置完毕========"LOG"=========Core setting point setting completed========"
#四、虚拟机操作#4. Virtual Machine Operation
#(1)提示倒计时。#(1) Prompt countdown.
LOG"========虚拟机开始启动========"LOG"=========The virtual machine starts========"
TIME_COUNTDOWN=5TIME_COUNTDOWN=5
while[${TIME_COUNTDOWN}-gt0];dowhile[${TIME_COUNTDOWN}-gt0];do
LOG"虚拟机${VM_NAME}:${VM_ID}将在${TIME_COUNTDOWN}s后启动,请切换至Linux的维护模式!"LOG"Virtual machine ${VM_NAME}:${VM_ID} will start after ${TIME_COUNTDOWN}s, please switch to Linux maintenance mode!"
sleep1sleep1
TIME_COUNTDOWN=$((TIME_COUNTDOWN-1))TIME_COUNTDOWN=$((TIME_COUNTDOWN-1))
donedone
LOG"========虚拟机启动完成========"LOG"=========Virtual machine startup completed========"
#(2)启动虚拟机。#(2)Start the virtual machine.
qmstart${VM_ID}。qmstart${VM_ID}.
在虚拟机启动后即提示可进行下一步。After the virtual machine starts, you will be prompted to proceed to the next step.
在本实施例中,第一脚本(s1_create.sh)的大致思路为:In this embodiment, the general idea of the first script (s1_create.sh) is:
首先进行参数配置,包括虚拟机名称、CPU、内存、启动磁盘和系统安装磁盘容量等。然后进行文件检测,包括待刻录的虚拟机系统文件和带维护模式的 Linux 文件。若文件不存在,则从网络下载并解压。接着创建默认虚拟机,包括获取虚拟机 ID、创建空白虚拟机、设置 CPU、内存、BIOS、机器类型等。最后进行关键设置点设置,包括创建虚拟光驱并填入相应镜像文件,创建空白虚拟硬盘用于刻录和安装虚拟机系统,设置启动顺序并激活虚拟设备。First, configure the parameters, including the virtual machine name, CPU, memory, boot disk, and system installation disk capacity. Then perform file detection, including the virtual machine system files to be burned and the Linux files with maintenance mode. If the file does not exist, download it from the network and decompress it. Then create a default virtual machine, including obtaining the virtual machine ID, creating a blank virtual machine, setting the CPU, memory, BIOS, machine type, etc. Finally, set the key setting points, including creating a virtual CD-ROM drive and filling in the corresponding image file, creating a blank virtual hard disk for burning and installing the virtual machine system, setting the startup order and activating the virtual device.
在本实施例中,在局域网中搭建临时脚本存储服务的手段为现有技术,这里不再赘述步骤和原理,可搭建在运行虚拟机的设备上(利用虚拟机软件搭建或运行虚拟机的宿主设备的系统搭建),或者选择一台性能适中的计算机作为服务器,确保其具有稳定的网络连接和足够的存储空间来存储脚本和镜像文件。In this embodiment, the means of building a temporary script storage service in a local area network is an existing technology, and the steps and principles are not repeated here. It can be built on a device running a virtual machine (built using virtual machine software or a system of a host device running a virtual machine), or a computer with moderate performance can be selected as a server to ensure that it has a stable network connection and sufficient storage space to store scripts and image files.
第二步、启动虚拟机后因跨越不同系统需要手动选择进入Linux的维护模式中的命令行界面,(由于是现有技术的操作界面,因此不再附图和具体赘述功能),操作步骤如下:Step 2: After starting the virtual machine, you need to manually select the command line interface in the Linux maintenance mode because it spans different systems (since it is an operation interface of the prior art, it will not be shown in the figure or detailed description of the function). The operation steps are as follows:
a)在RockyLinx安装界面选择Troubleshooting-->选项后按“Enter”键。a) On the RockyLinx installation interface, select Troubleshooting--> and press the "Enter" key.
b)选择RescueaRockyLinuxsystem选项,按“Enter”键。b) Select the RescueaRockyLinuxsystem option and press the "Enter" key.
c)待加载完毕后,按“1”键,再按“Enter”键回车,进入了维护模式的命令行界面。c) After the loading is complete, press the "1" key, then press the "Enter" key to enter the command line interface of the maintenance mode.
第三步、创建或下载并执行如下脚本【s2_burn.sh】实现自动化刻录系统,s2_burn.sh的脚本内容如下:Step 3. Create or download and execute the following script [s2_burn.sh] to implement the automated burning system. The script content of s2_burn.sh is as follows:
#!/bin/bash#!/bin/bash
#ScriptName:s2_brun.sh#ScriptName:s2_brun.sh
#Description:技术点第2步-用于PVE虚拟管理系统下虚拟机自动化刻录。#Description: Technical point step 2 - used for automatic burning of virtual machines under the PVE virtual management system.
#存放于Linux的维护模式中:#Stored in Linux maintenance mode:
#->要么部署临时文件服务器,采用wget命令下载至维护模式中(建议)。#->Either deploy a temporary file server and use the wget command to download to maintenance mode (recommended).
#->要么在维护模式中新建shellscript文件,手打全部命令。#-> Either create a new shellscript file in maintenance mode and type all the commands manually.
#因维护模式中文乱码,日志采用英文输出。#Because Chinese characters are garbled in maintenance mode, logs are output in English.
#Author:Candy#Author:Candy
#Date:2024-08-07#Date:2024-08-07
##################################################################
#参数配置##Parameter Configuration#
##################################################################
readonlyVM_NAME="OpenWrt"readonlyVM_NAME="OpenWrt"
#与create.sh中定义的变量相同,用于自动匹配装载的虚拟启动硬盘。#Same as the variable defined in create.sh, used to automatically match the mounted virtual boot hard disk.
readonlyVM_BOOTDISK=5readonlyVM_BOOTDISK=5
#与create.sh中定义的变量相同,用于自动匹配装载的虚拟使用硬盘。#Same as the variable defined in create.sh, used to automatically match the mounted virtual hard disk.
readonlyVM_HARDDISK=16readonlyVM_HARDDISK=16
##################################################################
#刻录步骤##Burn Steps#
##################################################################
#(1)检测所有虚拟硬盘是否成功加载,数量要大于等于2。#(1) Check whether all virtual hard disks are loaded successfully. The number must be greater than or equal to 2.
echoecho
echo"========STARTCheckingDisks========"echo "========STARTCheckingDisks========"
DISKS_COUNT=$(lsblk-oTYPEawk'$1=="disk"{count++}END{printcount}')DISKS_COUNT=$(lsblk-oTYPEawk'$1=="disk"{count++}END{printcount}')
if["${DISKS_COUNT}"-lt2];thenif["${DISKS_COUNT}"-lt2];then
echo"Failedtoloaddisks,exitburning."echo "Failedtoloaddisks,exitburning."
exit1exit1
fifi
echo"Therequired${DISKS_COUNT}numberofdiskshavebeenloaded."echo "Therequired${DISKS_COUNT}numberofdiskshavebeenloaded."
echo"========ENDCheckingDisks========"echo "========ENDCheckingDisks========"
echoecho
#(2)检测所有虚拟光驱是否成功加载,数量要大于等于2。#(2) Check whether all virtual CD-ROM drives are loaded successfully. The number must be greater than or equal to 2.
echo"========STARTCheckingCDROMs========"echo "========STARTCheckingCDROMs========"
CDROMS_COUNT=$(lsblk-oTYPEawk'$1=="rom"{count++}END{printcount}')CDROMS_COUNT=$(lsblk-oTYPEawk'$1=="rom"{count++}END{printcount}')
if["${CDROMS_COUNT}"-lt2];thenif["${CDROMS_COUNT}"-lt2];then
echo"Failedtoloadcdroms,exitburning."echo "Failedtoloadcdroms,exitburning."
exit1exit1
fifi
echo"Therequired${CDROMS_COUNT}numberofcdromshavebeenloaded."echo "Therequired${CDROMS_COUNT}numberofcdromshavebeenloaded."
echo"========ENDCheckingCDROMs========"echo "========ENDCheckingCDROMs========"
echoecho
#(3)自动匹配虚拟硬盘。#(3)Automatically match the virtual hard disk.
echo"========STARTMatchingDisks========"echo "========STARTMatchingDisks========"
echo"Automaticallymatchdisknamesbasedontheircapacity:"echo "Automaticallymatchdisknamesbasedontheircapacity:"
NAME_BOOTDISK=$(lsblk-oNAME,SIZE,TYPEawk-vsize="${VM_BOOTDISK}G"'$2==size&&$3=="disk"{print$1}')NAME_BOOTDISK=$(lsblk-oNAME,SIZE,TYPEawk-vsize="${VM_BOOTDISK}G"'$2==size&&$3=="disk"{print$1}')
NAME_HARDDISK=$(lsblk-oNAME,SIZE,TYPEawk-vsize="${VM_HARDDISK}G"'$2==size&&$3=="disk"{print$1}')NAME_HARDDISK=$(lsblk-oNAME,SIZE,TYPEawk-vsize="${VM_HARDDISK}G"'$2==size&&$3=="disk"{print$1}')
echo"Thematchedbootdisk1is\"${NAME_BOOTDISK}\",harddisk2is\"${NAME_HARDDISK}\"."echo"Thematchedbootdisk1is\"${NAME_BOOTDISK}\",harddisk2is\"${NAME_HARDDISK}\"."
if[-z"${NAME_BOOTDISK}"][-z"${NAME_HARDDISK}"];thenif[-z"${NAME_BOOTDISK}"][-z"${NAME_HARDDISK}"];then
echo"Failedtomatchdisks,exitburning."echo "Failedtomatchdisks,exitburning."
exit1exit1
fifi
echo"========ENDMatchingDisks========"echo "========ENDMatchingDisks========"
echoecho
#(4)自动匹配虚拟光驱。#(4) Automatically match the virtual CD-ROM drive.
echo"========STARTMatchingCDROMs========"echo "========STARTMatchingCDROMs========"
echo"Automaticallymatchcdromnamesbasedontheirtype:"echo "Automaticallymatchcdromnamesbasedontheirtype:"
NAME_RESCUECDROM=$(lsblk-oNAME,TYPE,MOUNTPOINTawk-vmp="/run/install/repo"'$2=="rom"&&$3==mp{print$1}')NAME_RESCUECDROM=$(lsblk-oNAME,TYPE,MOUNTPOINTawk-vmp="/run/install/repo"'$2=="rom"&&$3==mp{print$1}')
NAME_SYSTEMCDROM=$(lsblk-oNAME,TYPE,MOUNTPOINTawk'$2=="rom"&&$3==""{print$1}')NAME_SYSTEMCDROM=$(lsblk-oNAME,TYPE,MOUNTPOINTawk'$2=="rom"&&$3==""{print$1}')
echo"Thematchedrescuecdrom1is\"${NAME_RESCUECDROM}\",systemcdrom2is\"${NAME_SYSTEMCDROM}\"."echo"Thematchedrescuecdrom1is\"${NAME_RESCUECDROM}\",systemcdrom2is\"${NAME_SYSTEMCDROM}\"."
if[-z"${NAME_RESCUECDROM}"][-z"${NAME_SYSTEMCDROM}"];thenif[-z"${NAME_RESCUECDROM}"][-z"${NAME_SYSTEMCDROM}"];then
echo"Failedtomatchcdroms,exitburning."echo "Failedtomatchcdroms,exitburning."
exit1exit1
fifi
echo"========ENDMatchingCDROMs========"echo "========ENDMatchingCDROMs========"
echoecho
#(5)使用原生刻录命令实现自动化刻录。#(5) Use native burning commands to achieve automated burning.
echo"========STARTBurning========"echo "========STARTBurning========"
echo"Burnvirtualmachine'ssystemfromSystemCD-ROM(/dev/${NAME_SYSTEMCDROM})toBootableDisk(/dev/${NAME_BOOTDISK}):"echo "Burnvirtualmachine'ssystemfromSystemCD-ROM(/dev/${NAME_SYSTEMCDROM})toBootableDisk(/dev/${NAME_BOOTDISK}):"
ddif=/dev/${NAME_SYSTEMCDROM}of=/dev/${NAME_BOOTDISK}bs=4Mstatus=progressddif=/dev/${NAME_SYSTEMCDROM}of=/dev/${NAME_BOOTDISK}bs=4Mstatus=progress
if[$?-eq0];thenif[$?-eq0];then
echo"Congratulations,virtualmachine'ssystem\"${VM_NAME}\"isburnedsuccessful!"echo"Congratulations,virtualmachine'ssystem\"${VM_NAME}\"isburnedsuccessful!"
echo"Pleaseshutdownthisvirtualmachine."echo "Pleaseshutdownthisvirtualmachine."
echo"Andexecute\"clean.sh\"onthehostmachinetoproceedwiththesubsequentoperations."echo"Andexecute\"clean.sh\"onthehostmachinetoproceedwiththesubsequentoperations."
echo"========ENDBurning========"echo "========ENDBurning========"
echoecho
read-p"ShutdownNow?(y/n):"answerread-p"ShutdownNow?(y/n):"answer
case${answer}incase${answer}in
[Yy]*)[Yy]*)
echo"Shutdownthisvirtualmachinein3s..."echo "Shutdownthisvirtualmachinein3s..."
sleep3sleep3
shutdown-hnowshutdown-hnow
;;;;
[Nn]*)[Nn]*)
echo"Cancel.Pleasemanuallyshutdown."echo "Cancel.Pleasemanuallyshutdown."
;;;;
*)*)
echo"Invalidinput,pleaseenteryorn."echo "Invalidinput,pleaseenteryorn."
;;;;
esacesac
elseelse
echo"Burningfailed,pleasetryagain."echo "Burningfailed,pleasetryagain."
echo"========ENDBurning========"echo "========ENDBurning========"
fifi
执行顺利后,开始刻录。After the execution is successful, start burning.
在本实施例中,第二脚本(s2_burn.sh)的大致思路为:In this embodiment, the general idea of the second script (s2_burn.sh) is:
首先检测所有虚拟硬盘和虚拟光驱是否成功加载,数量要大于等于 2。然后自动匹配虚拟硬盘和虚拟光驱,根据容量和类型进行匹配。最后使用原生刻录命令实现自动化刻录,将虚拟机系统从系统 CD-ROM 刻录到启动磁盘。若刻录成功,提示用户关闭虚拟机,并执行后续清理操作。若刻录失败,则提示用户重新尝试。First, check whether all virtual hard disks and virtual optical drives are successfully loaded. The number must be greater than or equal to 2. Then automatically match virtual hard disks and virtual optical drives according to capacity and type. Finally, use the native burning command to achieve automatic burning, burning the virtual machine system from the system CD-ROM to the startup disk. If the burning is successful, prompt the user to shut down the virtual machine and perform subsequent cleanup operations. If the burning fails, prompt the user to try again.
第四步、关闭虚拟机后创建或下载并执行如下脚本【s3_clean.sh】实现后续安装前的自动化清理,s3_clean.sh的具体代码如下:Step 4. After shutting down the virtual machine, create or download and execute the following script [s3_clean.sh] to achieve automatic cleanup before subsequent installation. The specific code of s3_clean.sh is as follows:
#!/bin/bash#!/bin/bash
#ScriptName:s3_clean.sh#ScriptName:s3_clean.sh
#Description:技术点第3步-用于PVE虚拟管理系统下虚拟机自动化清理。#Description: Technical point step 3 - used for automatic cleanup of virtual machines under the PVE virtual management system.
#Author:Candy#Author:Candy
#Date:2024-08-08#Date:2024-08-08
##################################################################
#参数配置##Parameter Configuration#
##################################################################
readonlyVM_NAME="OpenWrt"readonlyVM_NAME="OpenWrt"
#与create.sh中定义的变量相同。#Same as the variables defined in create.sh.
readonlyVM_BOOT_DISK=5readonlyVM_BOOT_DISK=5
#与create.sh中定义的变量相同。#Same as the variables defined in create.sh.
readonlyVM_HARD_DISK=16readonlyVM_HARD_DISK=16
##################################################################
#操作步骤##Steps#
##################################################################
echoecho
echo"========虚拟机清理开始========"echo "=========Virtual machine cleanup started========"
#(1)根据名称查找之前创建的虚拟机。#(1) Search for the previously created virtual machine by name.
VM_ID=$(qmlistgrep-i${VM_NAME}awk'{print$1}')VM_ID=$(qmlistgrep-i${VM_NAME}awk'{print$1}')
if[-z"${VM_ID}"];thenif[-z"${VM_ID}"];then
echo">>>>>错误:无法找到指定的“${VM_NAME}”虚拟机。"echo">>>>>Error: Unable to find the specified '${VM_NAME}' virtual machine."
echo"========虚拟机清理失败========"echo"=========Virtual machine cleanup failed========"
exit1exit1
fifi
echo">>>>>找到虚拟机“${VM_NAME}:${VM_ID}”。"echo">>>>>Found virtual machine "${VM_NAME}:${VM_ID}".
#(2)停止虚拟机。#(2)Stop the virtual machine.
echo">>>>>停止虚拟机${VM_ID}。"echo">>>>>Stop virtual machine ${VM_ID}."
qmstop${VM_ID}qmstop${VM_ID}
#(3)删除所有虚拟光驱。#(3) Delete all virtual drives.
CDROMS=$(qmconfig${VM_ID}grep-oP'^(idesatascsi)\d+:.*cdrom'cut-d:-f1)CDROMS=$(qmconfig${VM_ID}grep-oP'^(idesatascsi)\d+:.*cdrom'cut-d:-f1)
forCDROMin${CDROMS};doforCDROMin${CDROMS};do
qmset${VM_ID}-delete${CDROM}qmset ${VM_ID} -delete ${CDROM}
echo">>>>>虚拟光驱“${CDROM}”已从虚拟机“${VM_NAME}:${VM_ID}”中删除。"echo">>>>>The virtual CD-ROM drive "${CDROM}" has been deleted from the virtual machine "${VM_NAME}:${VM_ID}"."
donedone
#(4)查找虚拟硬盘。#(4) Search for the virtual hard disk.
ID_BOOTDISK=$(echo$(qmconfig${VM_ID}grep-E"size=${VM_BOOT_DISK}G")awk-F:'{print$1}')ID_BOOTDISK=$(echo$(qmconfig${VM_ID}grep-E"size=${VM_BOOT_DISK}G")awk-F:'{print$1}')
if[-z"${ID_BOOTDISK}"];thenif[-z"${ID_BOOTDISK}"];then
echo">>>>>错误:无法找到指定的启动磁盘。"echo">>>>>Error: Unable to find the specified startup disk."
echo"========虚拟机清理失败========"echo"=========Virtual machine cleanup failed========"
exit1exit1
fifi
echo">>>>>查找到启动磁盘:${ID_BOOTDISK}。"echo">>>>>Found the boot disk: ${ID_BOOTDISK}."
ID_HARDDISK=$(echo$(qmconfig${VM_ID}grep-E"size=${VM_HARD_DISK}G")awk-F:'{print$1}')ID_HARDDISK=$(echo$(qmconfig${VM_ID}grep-E"size=${VM_HARD_DISK}G")awk-F:'{print$1}')
if[-z"${ID_HARDDISK}"];thenif[-z"${ID_HARDDISK}"];then
echo">>>>>错误:无法找到指定的系统磁盘。"echo">>>>>Error: Unable to find the specified system disk."
echo"========虚拟机清理失败========"echo"=========Virtual machine cleanup failed========"
exit1exit1
fifi
echo">>>>>查找到系统磁盘:${ID_HARDDISK}。"echo">>>>>Found system disk: ${ID_HARDDISK}."
#(4)设置启动顺序(虚拟启动硬盘1、虚拟空白硬盘2)并激活虚拟设备。#(4) Set the boot sequence (virtual boot hard disk 1, virtual blank hard disk 2) and activate the virtual device.
qmset${VM_ID}--bootorder="${ID_BOOTDISK};${ID_HARDDISK}"--bootdisk${ID_BOOTDISK}qmset${VM_ID}--bootorder="${ID_BOOTDISK};${ID_HARDDISK}"--bootdisk${ID_BOOTDISK}
echo"========虚拟机清理完毕========"echo"=========Virtual machine cleanup completed========"
echo">>>>>启动虚拟机${VM_ID}。"echo">>>>>Start virtual machine ${VM_ID}."
qmstart${VM_ID}qmstart${VM_ID}
echo">>>>>虚拟机${VM_ID}已启动,请继续虚拟机系统的安装。"echo">>>>>The virtual machine ${VM_ID} has been started. Please continue to install the virtual machine system."
echoecho
执行顺利后,可进行虚拟机系统的安装。After successful execution, you can install the virtual machine system.
在本实施例中,第三脚本(s3_clean.sh)的大致思路为:In this embodiment, the general idea of the third script (s3_clean.sh) is:
首先根据名称查找之前创建的虚拟机,若找不到则退出。然后停止虚拟机,删除所有虚拟光驱。接着查找虚拟硬盘,若找不到则退出。最后设置启动顺序并激活虚拟设备,启动虚拟机,提示用户继续虚拟机系统的安装。First, search for the previously created virtual machine by name. If it is not found, exit. Then stop the virtual machine and delete all virtual CD-ROMs. Next, search for the virtual hard disk. If it is not found, exit. Finally, set the boot order and activate the virtual device, start the virtual machine, and prompt the user to continue the installation of the virtual machine system.
第五步、附脚本【s4_destroy.sh】实现自动化测试,(非必须脚本及步骤),s4_destroy.sh的具体代码如下:Step 5. Attach the script [s4_destroy.sh] to implement automated testing (not a required script or step). The specific code of s4_destroy.sh is as follows:
#!/bin/bash#!/bin/bash
#ScriptName:s4_destroy.sh#ScriptName:s4_destroy.sh
#Description:技术点第4步-用于PVE虚拟管理系统下虚拟机删除。#Description: Technical point step 4 - used for virtual machine deletion under PVE virtual management system.
#Author:Candy#Author:Candy
#Date:2024-08-09#Date:2024-08-09
##################################################################
#参数配置##Parameter Configuration#
##################################################################
aliasLOG='f(){echo[$(TZ=UTC-8date"+%H:%M:%S")]:$1;};f'aliasLOG='f(){echo[$(TZ=UTC-8date"+%H:%M:%S")]:$1;};f'
##################################################################
#操作步骤##Steps#
##################################################################
LOG"========开始删除虚拟机========"LOG"========Start deleting virtual machine========"
read-p">>>请输入要删除的虚拟机ID(输入0删除所有):"VM_IDread-p">>>Please enter the virtual machine ID to be deleted (enter 0 to delete all):"VM_ID
if["${VM_ID}"-eq0];thenif["${VM_ID}"-eq0];then
qmlistawk'NR>1'whileIFS=read-rline;doqmlistawk'NR>1'whileIFS=read-rline;do
NAME=$(echo"$line"awk'{print$2}')NAME=$(echo"$line"awk'{print$2}')
ID=$(echo"$line"awk'{print$1}')ID=$(echo"$line"awk'{print$1}')
LOG"正在删除虚拟机${NAME}:${ID}。"LOG "Deleting virtual machine ${NAME}:${ID}."
qmstop${ID}qmstop${ID}
sleep3sleep3
qmdestroy${ID}--purgeqmdestroy ${ID} --purge
LOG"虚拟机${NAME}:${ID}已删除。"LOG "Virtual machine ${NAME}:${ID} has been deleted."
donedone
elseelse
VM_NAME=$(qmconfig"${VM_ID}"grepnameawk-F':''{print$2}')VM_NAME=$(qmconfig"${VM_ID}"grepnameawk-F':''{print$2}')
if[-z"${VM_NAME}"];thenif[-z"${VM_NAME}"];then
LOG"虚拟机${VM_ID}不存在!"LOG "Virtual machine ${VM_ID} does not exist!"
exit1exit1
fifi
LOG"正在删除虚拟机${VM_NAME}:${VM_ID}。"LOG "Deleting virtual machine ${VM_NAME}:${VM_ID}."
qmstop${VM_ID}qmstop${VM_ID}
sleep3sleep3
qmdestroy${VM_ID}--purgeqmdestroy ${VM_ID} --purge
LOG"虚拟机${VM_NAME}:${VM_ID}已删除。"LOG "Virtual machine ${VM_NAME}:${VM_ID} has been deleted."
fifi
LOG"========删除虚拟机完成========"LOG"========Deleting virtual machine completed========"
在本实施例中,第四脚本(s4_destroy.sh)的大致思路为:In this embodiment, the general idea of the fourth script (s4_destroy.sh) is:
用户可以输入要删除的虚拟机 ID,若输入 0 则删除所有虚拟机。首先停止虚拟机,然后删除虚拟机并清除相关数据。The user can enter the VM ID to be deleted. If 0 is entered, all VMs will be deleted. First, the VM will be stopped, then deleted and related data will be cleared.
通过以上步骤,本发明实现了在 Proxmox VE 中虚拟机系统的自动化刻录及安装,提高了兼容性、降低了成本、减小了风险、提高了效率。Through the above steps, the present invention realizes the automated burning and installation of the virtual machine system in Proxmox VE, which improves compatibility, reduces costs, reduces risks, and improves efficiency.
本实施展示的图中命令行界面的代码均为代码规范所要求,因此无法翻译为中文,仅在于注释部分内容可以写成中文。The codes of the command line interface in the figure shown in this implementation are all required by the code standards and therefore cannot be translated into Chinese. Only the comments can be written in Chinese.
实施例二Embodiment 2
基于相同的构思,本发明还提出了一种自动化刻录虚拟机系统的装置,包括:Based on the same concept, the present invention also proposes a device for automatically burning a virtual machine system, comprising:
临时文件存储服务器模块,用于存储所有脚本和镜像文件;Temporary file storage server module, used to store all scripts and image files;
局域网模块,提供本地网络服务,用于临时文件存储服务器模块和虚拟机模块的数据交互;The LAN module provides local network services for data interaction between the temporary file storage server module and the virtual machine module;
虚拟机模块,用于创建默认参数的虚拟机,并将虚拟光驱和虚拟硬盘的数量均设置为两个;将待维护模式的Linux系统的镜像文件填入第一个虚拟光驱内,将待刻录虚拟机系统的镜像文件填入第二个虚拟光驱内,同时按需设定两个虚拟硬盘的容量;设置启动顺序,按第一个虚拟光驱,第二个虚拟光驱,第一个虚拟硬盘以及第二个虚拟硬盘进行设置并激活虚拟机;虚拟机启动后,进入Linux的维护模式的命令行界面;创建或下载并执行第二脚本;使用刻录命令进行刻录,将待刻录虚拟机系统从第二个虚拟光驱刻录到第一个虚拟硬盘内;刻录成功后关闭虚拟机。The virtual machine module is used to create a virtual machine with default parameters and set the number of virtual optical drives and virtual hard disks to two; fill the image file of the Linux system to be maintained in the first virtual optical drive, fill the image file of the virtual machine system to be burned in the second virtual optical drive, and set the capacity of the two virtual hard disks as needed; set the startup sequence, set and activate the virtual machine according to the first virtual optical drive, the second virtual optical drive, the first virtual hard disk and the second virtual hard disk; after the virtual machine is started, enter the command line interface of the Linux maintenance mode; create or download and execute the second script; use the burning command to burn, and burn the virtual machine system to be burned from the second virtual optical drive to the first virtual hard disk; and shut down the virtual machine after the burning is successful.
实施例三Embodiment 3
本实施例还提供了一种电子装置,参考图2,包括存储器404和处理器402,该存储器404中存储有计算机程序,该处理器402被设置为运行计算机程序以执行上述任一项方法实施例中的步骤。This embodiment further provides an electronic device, referring to FIG. 2 , comprising a memory 404 and a processor 402 , wherein the memory 404 stores a computer program, and the processor 402 is configured to run the computer program to execute the steps in any one of the above method embodiments.
具体地,上述处理器402可以包括中央处理器(CPU),或者特定集成电路(ApplicationSpecificIntegratedCircuit,简称为ASIC),或者可以被配置成实施本发明实施例的一个或多个集成电路。Specifically, the processor 402 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiment of the present invention.
其中,存储器404可以包括用于数据或指令的大容量存储器404。举例来说而非限制,存储器404可包括硬盘驱动器(HardDiskDrive,简称为HDD)、软盘驱动器、固态驱动器(SolidStateDrive,简称为SSD)、闪存、光盘、磁光盘、磁带或通用串行总线(UniversalSerialBus,简称为USB)驱动器或者两个或更多个以上这些的组合。在合适的情况下,存储器404可包括可移除或不可移除(或固定)的介质。在合适的情况下,存储器404可在数据处理装置的内部或外部。在特定实施例中,存储器404是非易失性(Non-Volatile)存储器。在特定实施例中,存储器404包括只读存储器(Read-OnlyMemory,简称为ROM)和随机存取存储器(RandomAccessMemory,简称为RAM)。在合适的情况下,该ROM可以是掩模编程的ROM、可编程ROM(ProgrammableRead-OnlyMemory,简称为PROM)、可擦除PROM(ErasableProgrammableRead-OnlyMemory,简称为EPROM)、电可擦除PROM(ElectricallyErasableProgrammableRead-OnlyMemory,简称为EEPROM)、电可改写ROM(ElectricallyAlterableRead-OnlyMemory,简称为EAROM)或闪存(FLASH)或者两个或更多个以上这些的组合。在合适的情况下,该RAM可以是静态随机存取存储器(StaticRandom-AccessMemory,简称为SRAM)或动态随机存取存储器(DynamicRandomAccessMemory,简称为DRAM),其中,DRAM可以是快速页模式动态随机存取存储器404(FastPageModeDynamicRandomAccessMemory,简称为FPMDRAM)、扩展数据输出动态随机存取存储器(ExtendedDateOutDynamicRandomAccessMemory,简称为EDODRAM)、同步动态随机存取内存(SynchronousDynamicRandom-AccessMemory,简称SDRAM)等。Among them, the memory 404 may include a large capacity memory 404 for data or instructions. For example, but not limitation, the memory 404 may include a hard disk drive (HDD), a floppy disk drive, a solid state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a tape, or a universal serial bus (USB) drive, or a combination of two or more of these. In appropriate cases, the memory 404 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 404 may be inside or outside the data processing device. In a specific embodiment, the memory 404 is a non-volatile memory. In a specific embodiment, the memory 404 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (Programmable Read-Only Memory, PROM for short), an erasable PROM (Erasable Programmable Read-Only Memory, EPROM for short), an electrically erasable PROM (Electrically Erasable Programmable Read-Only Memory, EEPROM for short), an electrically alterable ROM (Electrically Alterable Read-Only Memory, EAROM for short) or a flash memory (FLASH) or a combination of two or more of these. In appropriate circumstances, the RAM may be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM may be a fast page mode dynamic random access memory 404 (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
存储器404可以用来存储或者缓存需要处理和/或通信使用的各种数据文件,以及处理器402所执行的可能的计算机程序指令。The memory 404 may be used to store or cache various data files required for processing and/or communication, as well as possible computer program instructions executed by the processor 402 .
处理器402通过读取并执行存储器404中存储的计算机程序指令,以实现上述实施例中的任意一种自动化刻录虚拟机系统的方法。The processor 402 reads and executes the computer program instructions stored in the memory 404 to implement any one of the methods for automatically burning a virtual machine system in the above embodiments.
可选地,上述电子装置还可以包括传输设备406以及输入输出设备408,其中,该传输设备406和上述处理器402连接,该输入输出设备408和上述处理器402连接。Optionally, the electronic device may further include a transmission device 406 and an input/output device 408 , wherein the transmission device 406 is connected to the processor 402 , and the input/output device 408 is connected to the processor 402 .
传输设备406可以用来经由一个网络接收或者发送数据。上述的网络具体实例可包括电子装置的通信供应商提供的有线或无线网络。在一个实例中,传输设备包括一个网络适配器(Network Interface Controller,简称为NIC),其可通过基站与其他网络设备相连从而可与互联网进行通讯。在一个实例中,传输设备406可以为射频(Radio Frequency,简称为RF)模块,其用于通过无线方式与互联网进行通讯。The transmission device 406 can be used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired or wireless network provided by a communication provider of the electronic device. In one example, the transmission device includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 406 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
输入输出设备408用于输入或输出信息。Input/output devices 408 are used to input or output information.
实施例四Embodiment 4
本实施例还提供了一种可读存储介质,可读存储介质中存储有计算机程序,计算机程序包括用于控制过程以执行过程的程序代码,过程包括根据实施例一的自动化刻录虚拟机系统的方法。This embodiment further provides a readable storage medium, in which a computer program is stored. The computer program includes a program code for controlling a process to execute the process. The process includes the method for automatically burning a virtual machine system according to the first embodiment.
需要说明的是,本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
通常,各种实施例可以以硬件或专用电路、软件、逻辑或其任何组合来实现。本发明的一些方面可以以硬件来实现,而其他方面可以由控制器、微处理器或其他计算设备执行的固件或软件来实现,但是本发明不限于此。尽管本发明的各个方面可以被示出和描述为框图、流程图或使用一些其他图形表示,但是应当理解,作为非限制性示例,本文中描述的这些框、装置、系统、技术或方法可以以硬件、软件、固件、专用电路或逻辑、通用硬件或控制器或其他计算设备或其某种组合来实现。In general, various embodiments may be implemented in hardware or dedicated circuits, software, logic, or any combination thereof. Some aspects of the invention may be implemented in hardware, while other aspects may be implemented in firmware or software executed by a controller, microprocessor, or other computing device, but the invention is not limited thereto. Although various aspects of the invention may be shown and described as block diagrams, flow charts, or using some other graphical representation, it should be understood that, as non-limiting examples, the boxes, devices, systems, techniques, or methods described herein may be implemented in hardware, software, firmware, dedicated circuits or logic, general-purpose hardware or controllers or other computing devices, or some combination thereof.
本发明的实施例可以由计算机软件来实现,该计算机软件由移动设备的数据处理器诸如在处理器实体中可执行,或者由硬件来实现,或者由软件和硬件的组合来实现。包括软件例程、小程序和/或宏的计算机软件或程序(也称为程序产品)可以存储在任何装置可读数据存储介质中,并且它们包括用于执行特定任务的程序指令。计算机程序产品可以包括当程序运行时被配置为执行实施例的一个或多个计算机可执行组件。一个或多个计算机可执行组件可以是至少一个软件代码或其一部分。另外,在这一点上,应当注意,如图1中的逻辑流程的任何框可以表示程序步骤,或者互连的逻辑电路、框和功能,或者程序步骤和逻辑电路、框和功能的组合。软件可以存储在诸如存储器芯片或在处理器内实现的存储块等物理介质、诸如硬盘或软盘等磁性介质,以及诸如例如DVD及其数据变体、CD等光学介质上。物理介质是非瞬态介质。Embodiments of the present invention can be implemented by computer software, which is executable by a data processor of a mobile device, such as in a processor entity, or implemented by hardware, or implemented by a combination of software and hardware. Computer software or programs (also referred to as program products) including software routines, applets and/or macros can be stored in any device-readable data storage medium, and they include program instructions for performing specific tasks. Computer program products can include one or more computer executable components configured to perform embodiments when the program is running. One or more computer executable components can be at least one software code or a part thereof. In addition, at this point, it should be noted that any box of the logic flow in Figure 1 can represent program steps, or interconnected logic circuits, boxes and functions, or a combination of program steps and logic circuits, boxes and functions. Software can be stored in physical media such as memory chips or storage blocks implemented in processors, magnetic media such as hard disks or floppy disks, and optical media such as, for example, DVDs and data variants thereof, CDs. Physical media are non-transient media.
本领域的技术人员应该明白,以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。Those skilled in the art should understand that the technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
以上实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本发明范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以作出若干变形和改进,这些都属于本发明的保护范围。因此,本发明的保护范围应以所附权利要求为准。The above embodiments only express several implementation modes of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present invention. It should be pointed out that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the attached claims.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411247834.2A CN118760448B (en) | 2024-09-06 | 2024-09-06 | Method, device and application of automatic burning virtual machine system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411247834.2A CN118760448B (en) | 2024-09-06 | 2024-09-06 | Method, device and application of automatic burning virtual machine system |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN118760448A true CN118760448A (en) | 2024-10-11 |
| CN118760448B CN118760448B (en) | 2024-11-22 |
Family
ID=92944139
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202411247834.2A Active CN118760448B (en) | 2024-09-06 | 2024-09-06 | Method, device and application of automatic burning virtual machine system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN118760448B (en) |
Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20110258622A1 (en) * | 2010-04-20 | 2011-10-20 | International Business Machines Corporation | Pluggable activation engine extensions via virtual disks |
| US20140040887A1 (en) * | 2012-07-31 | 2014-02-06 | George Cristian Morariu | Customized virtual machine creation |
| US20150242225A1 (en) * | 2014-02-26 | 2015-08-27 | Red Hat Israel, Ltd. | Execution of a script based on properties of a virtual device associated with a virtual machine |
| CN106855820A (en) * | 2016-12-07 | 2017-06-16 | 高新兴科技集团股份有限公司 | The CD hot-plug method and system of a kind of virtual machine |
| US10114664B1 (en) * | 2015-09-21 | 2018-10-30 | Veritas Technologies Llc | Systems and methods for automated delivery and identification of virtual drives |
| CN110377394A (en) * | 2019-06-28 | 2019-10-25 | 苏州浪潮智能科技有限公司 | A kind of creation method and device of virtual machine |
| CN112068927A (en) * | 2020-08-12 | 2020-12-11 | 福建升腾资讯有限公司 | Method and system for redirecting CD-RW (compact disk) of cloud desktop |
| CN116225618A (en) * | 2023-03-02 | 2023-06-06 | 统信软件技术有限公司 | Method for starting virtual machine based on container mirror image and virtual machine starting device |
-
2024
- 2024-09-06 CN CN202411247834.2A patent/CN118760448B/en active Active
Patent Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20110258622A1 (en) * | 2010-04-20 | 2011-10-20 | International Business Machines Corporation | Pluggable activation engine extensions via virtual disks |
| US20140040887A1 (en) * | 2012-07-31 | 2014-02-06 | George Cristian Morariu | Customized virtual machine creation |
| US20150242225A1 (en) * | 2014-02-26 | 2015-08-27 | Red Hat Israel, Ltd. | Execution of a script based on properties of a virtual device associated with a virtual machine |
| US10114664B1 (en) * | 2015-09-21 | 2018-10-30 | Veritas Technologies Llc | Systems and methods for automated delivery and identification of virtual drives |
| CN106855820A (en) * | 2016-12-07 | 2017-06-16 | 高新兴科技集团股份有限公司 | The CD hot-plug method and system of a kind of virtual machine |
| CN110377394A (en) * | 2019-06-28 | 2019-10-25 | 苏州浪潮智能科技有限公司 | A kind of creation method and device of virtual machine |
| CN112068927A (en) * | 2020-08-12 | 2020-12-11 | 福建升腾资讯有限公司 | Method and system for redirecting CD-RW (compact disk) of cloud desktop |
| CN116225618A (en) * | 2023-03-02 | 2023-06-06 | 统信软件技术有限公司 | Method for starting virtual machine based on container mirror image and virtual machine starting device |
Non-Patent Citations (1)
| Title |
|---|
| 坚强的花椒: "linux系统几种刻录镜像方式", Retrieved from the Internet <URL:《https://zhuanlan.zhihu.com/p/628298082》> * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN118760448B (en) | 2024-11-22 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN108614718B (en) | Method, device and implementing device for starting operating system | |
| CN102023908B (en) | Method and device for backing up boot program | |
| CN105590072A (en) | Method for achieving automatic burning of embedded system | |
| US20220214945A1 (en) | System Booting Method and Apparatus, Node Device, and Computer-Readable Storage Medium | |
| US9836417B2 (en) | Bridge configuration in computing devices | |
| CN116483468B (en) | Operating system installation method and device, computer equipment and storage medium | |
| CN110286932A (en) | Program downloading method and device | |
| CN115617488A (en) | Operating system migration method and device, computing equipment and storage medium | |
| CN111324418A (en) | OpenStack-based virtual machine template generation method and device | |
| CN118672682A (en) | Server starting method and device, server and storage medium | |
| CN114265603A (en) | System upgrade method, device and electronic device based on asymmetric partition | |
| CN114416148A (en) | A method, device and storage medium for hot upgrade of a hypervisor | |
| CN102053848A (en) | Automatic installation method for Linux operating system | |
| CN114625399A (en) | System upgrade method and related apparatus, equipment and storage medium | |
| CN114756290B (en) | Operating system installation method, device and readable storage medium | |
| CN115129570A (en) | Memory performance test method and related device | |
| WO2018049798A1 (en) | Method and apparatus for reconstructing cache partition | |
| CN118760448A (en) | Method, device and application of automatic burning virtual machine system | |
| CN114625389A (en) | Embedded equipment upgrading method, embedded equipment and storage device | |
| CN118092989A (en) | Firmware upgrading method, system, equipment and medium of memory | |
| CN115718612B (en) | A method for updating CF card operating system | |
| KR20180023575A (en) | Firmware auto updating method and computer readable recording medium writing firmware auto updating method | |
| CN102467522B (en) | Self-programming method and device of file system based on NAND flash | |
| CN113867747B (en) | server | |
| CN115658106A (en) | BIOS updating method and device, electronic equipment and storage medium |
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 | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |