Disclosure of Invention
In order to solve the defects in the prior art, the invention provides a mirror image manufacturing method, a system and a storage medium based on a virtual chemical control device, which solve the problems of large mirror image manufacturing quantity, large mirror image quantity and difficult deployment and maintenance caused by dynamically introducing and executing custom files, custom user data and custom scripts in the mirror image manufacturing process of the virtual chemical control device.
In order to achieve the above purpose, the technical scheme adopted by the invention is as follows:
In a first aspect, a method for manufacturing a mirror image based on a virtualization control device is provided, including: based on the built virtual laboratory, a cloud-init plug-in is installed on the basis of the basic mirror image of the virtual chemical control equipment; performing secondary encapsulation development on the computing service to perfect and call an API interface provided by the computing service, and realizing the service butt joint of the computing service based on Openstack for closed-init in the process of creating; and exporting the virtualized control equipment instance after dynamically loading the file and the user data through an mirror image service of Openstack to finish mirror image manufacture.
Further, the method for constructing the virtual laboratory comprises the following steps: constructing a cloud platform service based on OpenStack by using a hardware server, and providing basic cloud environment support for a virtual laboratory; based on OpenStack, a virtualized version of a given system host is manufactured, and virtual component support of industrial control equipment is provided for a virtual laboratory; and constructing a manager of the virtual laboratory and externally releasing the calling interface.
Further, in the virtual laboratory, a virtual machine of the industrial control device is created by mirroring the service-managed virtual vertical file.
Further, at least two hardware servers with the same configuration are built into a network through a switch, wherein one hardware server is used as a control node of OpenStack and used for controlling, managing and scheduling resources and component services of a cloud platform, and the services specifically deployed by the control node comprise network services, authentication services, graphical services and mirror image services; the rest of the hardware servers are all used as computing nodes of OpenStack and used for scheduling and processing computing resources, and the specifically deployed services of the computing nodes comprise computing services and network agents.
Further, the first network card of the control node is used as a management network for communication among the nodes, and the second network card of the control node is used as OverLay network for accessing the control node management network through the flow IP; the first network card of the computing node is used as a management network for the control node to directly communicate with each computing node, and the second network card of the computing node is used as a tunnel network for communicating between virtual machines on different computing nodes.
Further, the preparing a virtualized version of a given system host based on OpenStack provides a virtual component support of an industrial control device for a virtual laboratory, including: making a basic mirror image of the virtual chemical control equipment, and obtaining a basic mirror image file; dividing a management network for the virtualized control equipment, and managing the virtualized security equipment by connecting a management network port of the virtualized control equipment; dividing a service network for the virtual chemical control equipment, and connecting corresponding services according to the requirements of users; and installing built-in services of the affiliated virtual laboratory for the virtual chemical control equipment.
Further, the virtual laboratory manager operates in a Web service mode on a control node, the back end adopts Django to realize Web service, uWsgi +Nginx is used as a Web container and access scheduling, and MySQL database+Redis is used as data storage/cache service; the front end is implemented using HTML5+ cs3 + act.
In a second aspect, a mirror image making system based on a virtualization control device is provided, including a processor and a storage device, where the storage device stores a plurality of instructions for loading and executing the steps of the method in the first aspect by the processor.
In a third aspect, a computer readable storage medium is provided, the computer readable storage medium comprising a stored computer program, wherein the computer program, when executed by a processor, controls a device in which the storage medium is located to perform the method according to the first aspect.
Compared with the prior art, the invention has the beneficial effects that: according to the invention, the virtual laboratory built based on OpenStack is used for manufacturing the image file, so that the virtual chemical control equipment can dynamically introduce and execute the custom file, the custom user data and the custom script in the image manufacturing process; simplifying the mirror image manufacturing process, reducing the cost and improving the production efficiency.
Detailed Description
The invention is further described below with reference to the accompanying drawings. The following examples are only for more clearly illustrating the technical aspects of the present invention, and are not intended to limit the scope of the present invention.
Embodiment one:
As shown in fig. 1 and 2, a mirror image manufacturing method based on a virtualization control device includes: based on the built virtual laboratory, a cloud-init plug-in is installed on the basis of the basic mirror image of the virtual chemical control equipment; performing secondary encapsulation development on the computing service to perfect and call an API interface provided by the computing service, and realizing the service butt joint of the computing service based on Openstack for closed-init in the process of creating; and exporting the virtualized control equipment instance after dynamically loading the file and the user data through an mirror image service of Openstack to finish mirror image manufacture.
The virtual laboratory for dynamically constructing the safety protection model of the power monitoring system aims at designing and configuring a cloud computing system for providing experiment, teaching and attack and defense exercise services for the power system in an economic and cost-effective manner. In contrast to the system architecture in fig. 1, the specific construction method of the virtual laboratory includes: constructing a cloud platform service based on OpenStack by using a hardware server, and providing basic cloud environment support for a virtual laboratory; based on OpenStack, a virtualized version of a given system host is manufactured, and virtual component support of industrial control equipment is provided for a virtual laboratory; building a manager of a virtual laboratory and externally releasing and calling interfaces:
1. building a cloud platform service based on OpenStack by using a hardware server, and providing basic cloud environment support for a virtual laboratory:
And (3) modifying the network topology on the basis of a native OpenStack (Queens version) network service (Neutron) to realize virtual-real intercommunication network scene (namely, interconnection and intercommunication between the cloud internal virtual equipment and the cloud external physical equipment). This platform will provide basic cloud environment support for virtual laboratories.
OpenStack is an open-source cloud computing management platform, and specific work is completed by combining a plurality of components, so that a cloud computing platform which is simple to implement, can be expanded in a large scale, is rich and has unified standards is provided, and a solution of basic setting as a service (IaaS) is provided through various complementary services.
The virtual laboratory builds a cloud platform based on OpenStack (Queens version), and the specific services mainly utilized are as follows: computing services (Nova), web services (Neutron), authentication services (Keystone), graphics services (horizons), and mirror services (Glance).
The main deployment mode is as follows:
1) The required hardware: a plurality of (more than or equal to 2) hardware servers with the same configuration (the servers at least comprise a processor, a memory, a disk and network cards, the number of the network cards is more than or equal to 3, and a Centigrade OS 7 operating system is installed on the servers); the switches are used for cooperating with the hardware servers to build a network;
2) One of the plurality of hardware servers is used as an OpenStack control node for controlling, managing and scheduling resources of the cloud platform and other component services, and the specific deployment service of the control node is as follows: network service, authentication service, graphic service and mirror service (mirror service is used for managing mirror files required by a virtual laboratory, mainly virtual power portrait file, mirror file is a special file, specific files are manufactured into a single file according to a certain format, so that users can download and use the file conveniently, and the file can be identified and loaded by a specific program, and in the virtual laboratory, a virtual machine of an industrial control device can be created by the virtual portrait file managed by the mirror service. The first network card (eth 0) of the control node is used as a management network (used for communication among nodes), the second network card (eth 1) is used as OverLay network (namely a cross network: a communication network inside the cloud is vertical to virtual power, and the virtual power is vertical to the management network of the control node through a Float IP);
3) The rest of the plurality of hardware servers are all used as OpenStack computing nodes for scheduling and processing computing resources (CPU, memory, disk, network, etc.). The specific deployment services of each computing node are as follows: the system comprises computing services and network agents (DHCP agents, virtual switch agents and virtual router agents), wherein each agent is managed by the network services of control nodes, and finally realizes specific functions, the DHCP agents realize the functions of a DHCP server side and a client side, the virtual switch agents realize the functions of a two-layer switch, and the virtual router agents realize the functions of a three-layer route. The first network card (eth 0) of the computing node is used as a management network (the same control node management network is used for the direct communication between the control node and each computing node), and the second network card (eth 1) is used as a tunnel network (used for the communication between the power longitudinal cross computing nodes, namely the communication between the virtual machines on different computing nodes).
2. Based on OpenStack, a virtualized version of a given system host is made, and virtual component support of industrial control equipment is provided for a virtual laboratory:
Virtualization of industrial control equipment:
The industrial control equipment generally refers to a host server deployed by a congesting and kylin operating system used in an electric power system, and the industrial control equipment is used in a virtual laboratory and needs to be modified into virtual equipment (virtual industrial control equipment);
The transformation process is as follows:
Firstly, making a basic mirror image of virtual chemical control equipment, wherein the making process is as follows: uploading an image file of an ISO format (a file of an image format) of a required industrial control equipment version in Openstack, creating an example of the image by using a proper example type, installing a corresponding operating system on a console of the example after the example is successfully created, completing corresponding configuration such as a time zone, a network card, a disk and the like, and acquiring a basic image file of the example by using an ID (identification) of the example by using an image service of Openstack after the system is installed, wherein the type of the image file is qcow2 (a disk image format);
secondly, dividing a management network for the virtual chemical control equipment, setting a first network card (eth 0) of the virtual chemical control equipment as the management network, if the network card name of the operating system is not eth0, modifying a network card guide configuration file of the operating system, setting the network card guide configuration file as an eth mode, and in the application of a virtual laboratory, connecting a management network port of the virtual security equipment by using the management network of the virtual chemical control equipment to manage the management network port;
thirdly, dividing a service network for the virtual chemical control equipment, wherein a second network card (eth 1) of the virtual chemical control equipment is set as the service network, and the service network is connected with corresponding services according to specific requirements of users in the application of a virtual laboratory;
Finally, in the use of the virtual laboratory, the virtual laboratory self built-in service is required to be installed, including the division of the network in the virtual laboratory (whether the DHCP mode is used for acquiring the IP or the static mode), the specific network functions are realized among the components of each network type, the built-in service programs are copied to the catalog corresponding to the background of the virtual laboratory control equipment, and the built-in service programs are set to be started automatically, namely, the built-in service programs of the industrial control equipment automatically run in the form of daemon after the virtual machine is started.
3. Building a manager of a virtual laboratory and externally releasing and calling interfaces: constructing a manager of a virtual laboratory and an external release calling interface by utilizing various Web technologies; the method and the device provide convenience and flexible operation experience for users; at the same time, an adjustable interface is provided for external third party applications;
An important role of virtual laboratory management is to provide users with virtualized components in a power security scenario, including but not limited to virtual power portrait, virtual power quarantine, virtual UKey, virtual hosts (Windows 7, centOS 7), virtual routers, virtual switches, virtual network lines, etc.; the virtual laboratory manager has the other important function of providing a set of laboratory graphical management tool for users, the users can access by utilizing a browser and complete construction and configuration of classical electric power security topology experiment scenes, virtual-real intercommunication scenes, experimental case calling, attack and defense exercise and the like through flexible and convenient operation, and an experiment platform is provided for the users to know and proficiently construct and configure electric power proprietary service security scenes; the third role of the manager is to enable the laboratory to flexibly embed other third party platforms and provide a complete API (Application Programming Interface );
The virtual laboratory manager (running in the form of Web service on a control node) adopts Django (Python Web framework) to realize Web service at the back end, uWsgi +Nginx is used as a Web container and access scheduling, and MySQL (database) +Redis (NoSQL) is used as data storage/cache service; the front-end is implemented using the currently popular HTML5+ css3+ practice.
The method for manufacturing the virtual chemical control equipment mirror image by the custom file and the custom user data comprises the following steps:
Firstly, on the basis of the basic mirror image of the virtualized control equipment, a group-init plug-in (which is an application program which applies some self-defined configuration to a client in the initialization process) is installed, the plug-in is currently based on a Linux operating system, the installation mode can be installed in a YUM mode, and after the installation is completed, the virtualized control equipment currently has the function of defining some configuration independent of the operating system in the initialization process. A cloud host provider needs to initialize thousands of virtual hosts for clients every day, and these machines may use different operating systems, may set different IP addresses, different SSH keys, and set different host names according to the needs of the clients, so how to do this is required, and the group-init is born to solve this problem;
Secondly, to realize the butt joint of the computing service of Openstack to the service of closed-init in the process of creating, the computing service needs to be subjected to secondary encapsulation development to perfect the API interface provided by calling the computing service, the parameter processing of-files and-userdata is added to meet the loading of dynamic files and dynamic user data, the-files parameter realizes that the virtualization control equipment writes corresponding examples in the form of byte streams in the process of creating, the loading of files is realized, the-userdata realizes that the user data (comprising user-defined scripts or programs) is executed in the process of creating by the virtualization control equipment, and the same as-files, the transmitted user data is loaded into the examples in the form of byte streams and is executed;
Finally, exporting the virtualized control equipment instance after the file and the user data are dynamically loaded in the last step into a qcow 2-format mirror image through an Openstack mirror image service; after the virtual control device is created by the virtual laboratory, the instance created by the created image file qcow2 is internally provided with the file dynamically loaded by the user and the user data information of the loading execution. The virtual chemical control device can dynamically introduce and execute custom files, custom user data and custom scripts in the mirror image manufacturing process. Simplifying the mirror image manufacturing process, reducing the cost and improving the production efficiency.
Embodiment two:
The embodiment provides a mirror image manufacturing system based on a virtualization control device, which comprises a processor and a storage device, wherein a plurality of instructions are stored in the storage device and are used for loading and executing the steps of the method in the embodiment.
Embodiment III:
Based on the first and second embodiments, the present embodiment provides a computer readable storage medium, where the computer readable storage medium includes a stored computer program, where the computer program when executed by a processor controls a device where the storage medium is located to execute the method described in the first embodiment.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.