CN110704168A - Method and device for managing OpenStack virtual machine based on Terraform - Google Patents

Method and device for managing OpenStack virtual machine based on Terraform Download PDF

Info

Publication number
CN110704168A
CN110704168A CN201910978841.2A CN201910978841A CN110704168A CN 110704168 A CN110704168 A CN 110704168A CN 201910978841 A CN201910978841 A CN 201910978841A CN 110704168 A CN110704168 A CN 110704168A
Authority
CN
China
Prior art keywords
openstack
terraform
virtual machine
managing
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910978841.2A
Other languages
Chinese (zh)
Inventor
张栋梁
蒋方文
高申申
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Cloud Information Technology Co Ltd
Original Assignee
Inspur Cloud Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Cloud Information Technology Co Ltd filed Critical Inspur Cloud Information Technology Co Ltd
Priority to CN201910978841.2A priority Critical patent/CN110704168A/en
Publication of CN110704168A publication Critical patent/CN110704168A/en
Pending legal-status Critical Current

Links

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
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances

Landscapes

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

Abstract

The invention discloses a method and a device for managing OpenStack virtual machines based on Terraform, and belongs to the technical field of cloud computing and virtualization. According to the method for managing the OpenStack virtual machine based on the Terraform, the virtual machine is created on a page, background application is carried out, the OpenStack API is called by utilizing a Terraform provider plug-in, and the virtual machine is created. The method for managing the OpenStack virtual machine based on the Terraform can be suitable for cloud computing development, and has good popularization and application values.

Description

Method and device for managing OpenStack virtual machine based on Terraform
Technical Field
The invention relates to the technical field of cloud computing and virtualization, and particularly provides a method and a device for managing an OpenStack virtual machine based on Terraform.
Background
With the rapid development of cloud computing technology, more and more governments and enterprises are creating applications related to cloud computing, the cloud computing has already been taken as a next generation computing mode and completely enters a practical application stage, governments of various countries push main manufacturers to re-arrange around the cloud computing, innovation platforms, products and applications are continuously emerging, and more data and applications are migrating to the cloud computing. An important field in cloud computing technology is virtualization, and the core of virtualization is a virtual machine.
Disclosure of Invention
The technical task of the invention is to provide a method for managing OpenStack virtual machine based on Terraform, which can adapt to the development of cloud computing.
A further technical task of the present invention is to provide a device for managing OpenStack virtual machines based on Terraform.
In order to achieve the purpose, the invention provides the following technical scheme:
a method for managing an OpenStack virtual machine based on Terraform is characterized in that a page creates a virtual machine, background application is carried out, an OpenStack API is called by utilizing a Terraform provider plug-in, and virtual machine creation is completed.
Preferably, the method specifically comprises the following steps:
s1, checking an OpenStack deployment environment, and deploying OpenStack;
s2, compiling a Terraform provider plug-in;
s3, writing the web application and the background application.
Preferably, in step S1, the OpenStack deployment environment is checked, specifically, whether selinux is disabled is checked, the host network parameter is checked, whether a public key is imported, whether a related software package is installed, and the deployment is installed according to an OpenStack official document.
Preferably, the writing of the Terraform provider plug-in step S2 specifically includes the following processes: 1) installing a go language environment; 2) resource development; 3) configuring a tf file; 4) compiled into a go binary.
Terraform is an IT infrastructure automation organization tool whose slogan is "Write, Plan, and create Infra-structure Code", Terraform's main function is ① infrastructure Code (IaC) describing the infrastructure with a high level configuration syntax, the data center blueprint can be version managed just like other Code, furthermore, the infrastructure can be shared and reused, ② execution Plan Terraform has a Planning step to produce execution Plan which can show what changes the Terraform is going to make when executing Terraform's application, avoiding resource accidents while maintaining the infrastructure, ③ diagram Terraform produces a diagram and then builds and modifies independent resources in parallel, Terraform can build efficiently and create an automatic infrastructure change, ④ can avoid the most complicated changes to the infrastructure and the most complicated changes.
Preferably, the Resource development comprises calling OpenStack to create an API interface, calling OpenStack to inquire the API interface, calling OpenStack to modify the API interface, calling OpenStack to delete the API interface, calling OpenStack to create the API interface, and creating a virtual machine; calling an OpenStack query API interface to realize the query of the virtual machine; calling an OpenStack modification API interface to modify the current virtual information; and calling an OpenStack deletion API interface to delete the specified virtual machine.
And calling an OpenStack API interface to realize virtual machine creation, writing the Resource id into a state file, and calling inquiry and modification to complete more functions after the OpenStack API interface is created.
Calling an OpenStack query API interface to realize the query of the virtual machine, writing the virtual information into a state file, and marking Resource id as "" if the virtual information cannot be queried so as to inform that the Terraform virtual machine does not exist.
The method comprises the steps of calling an OpenStack modification API interface to modify current virtual information, opening Partial, d.partial (true) before modification, and updating after the modification is completed, such as d.SetPartial ("image"), so as to ensure that each step of modification at the back can be successfully written into a state file. After modification, a query method is called to query the latest virtual machine information for saving to the state file.
And calling the OpenStack deletion API interface to delete the specified virtual machine, and calling a query method after deletion to verify whether the virtual machine is successfully deleted.
Preferably, the configuration tf file includes a configuration main.tf file, a variable.tf file, and an output.tf file, wherein the main.tf file is a definition template of virtual machine parameters, the variable.tf file is a definition of virtual machine parameters depended on by the template, and the output.tf file is an output value of the virtual machine information.
Preferably, in writing Web application and background application, the Web application displays lists and detailed information of virtual machines and adds, deletes and changes operations of the virtual machines, the background application writes basic logic processing and a Provider actuator, the basic logic processing in the background application receives requests of the Web application, the Provider actuator is called according to different requests, and a terraform command is executed by using a java command line in the Provider actuator.
Terraform executes the command: tf files such as Terraform init initialization template information variables, tf, Terraform plan view Terraform execution plan, Terraform application execution template information, Terraform execution output Terraform execution result.
A device for managing an OpenStack virtual machine based on Terraform comprises an OpenStack deployment module, a virtual machine management module and a virtual machine management module, wherein the OpenStack deployment module is used for checking an OpenStack deployment environment and deploying OpenStack;
the Terraform provider plug-in writing module is used for writing a Terraform provider plug-in;
and the web application and background application writing module is used for writing the web application and the background application.
Preferably, the OpenStack deployment module is responsible for checking an OpenStack deployment environment, specifically, checking whether selinux is disabled, checking a host network parameter, whether a public key is imported, whether a related software package is installed, and installing and deploying according to an OpenStack official document.
Preferably, the writing of the terrafrorm provider plug-in module specifically includes the following processes: 1) installing a go language environment; 2) resource development; 3) configuring a tf file; 4) compiling into a go binary file; the Web application and background application compiling module is used for compiling the Web application and the background application, the Web application displays the list and the detailed information of the virtual machine and the operation of adding and deleting the virtual machine, the background application compiles a basic logic process and a Provider actuator, the basic logic process in the background application receives the request of the Web application, the Provider actuator is called according to different requests, and the Provider actuator executes a terrform command by using a java command line.
Compared with the prior art, the method for managing the OpenStack virtual machine based on the Terraform has the following outstanding beneficial effects: the method for managing the OpenStack virtual machine based on the Terraform combines virtual and cloud computing technologies, can adapt to the development of cloud computing, and has good popularization and application values.
Detailed Description
The method and apparatus for managing OpenStack virtual machine based on terrafrorm according to the present invention will be described in further detail with reference to the following embodiments.
Examples
The method for managing the OpenStack virtual machine based on the Terraform establishes the virtual machine on the page, applies the background, and calls the OpenStack API by utilizing a Terraform provider plug-in to complete the establishment of the virtual machine.
The method specifically comprises the following steps:
s1, checking the OpenStack deployment environment, and deploying OpenStack.
And checking an OpenStack deployment environment, specifically checking whether selinux is forbidden or not, checking host network parameters, whether a public key is imported or not, and whether a related software package is installed or not, and installing and deploying according to an OpenStack official document.
S2, writing a Terraform provider plug-in.
The method specifically comprises the following steps: 1) installing a go language environment; 2) resource development; 3) configuring a tf file; 4) compiled into a go binary.
The Resource development comprises calling OpenStack to create an API interface, calling OpenStack to inquire the API interface, calling OpenStack to modify the API interface and calling OpenStack to delete the API interface, calling OpenStack to create the API interface, and creating a virtual machine; calling an OpenStack query API interface to realize the query of the virtual machine; calling an OpenStack modification API interface to modify the current virtual information; and calling an OpenStack deletion API interface to delete the specified virtual machine.
And calling an OpenStack API interface to realize virtual machine creation, writing the Resource id into a state file, and calling inquiry and modification to complete more functions after the OpenStack API interface is created.
Calling an OpenStack query API interface to realize the query of the virtual machine, writing the virtual information into a state file, and marking Resource id as "" if the virtual information cannot be queried so as to inform that the Terraform virtual machine does not exist.
The method comprises the steps of calling an OpenStack modification API interface to modify current virtual information, opening Partial, d.partial (true) before modification, and updating after the modification is completed, such as d.SetPartial ("image"), so as to ensure that each step of modification at the back can be successfully written into a state file. After modification, a query method is called to query the latest virtual machine information for saving to the state file.
And calling the OpenStack deletion API interface to delete the specified virtual machine, and calling a query method after deletion to verify whether the virtual machine is successfully deleted.
The configuration tf file comprises a configuration main.tf file, a variable.tf file and an output.tf file, wherein the main.tf file is a definition template of virtual machine parameters, the variable.tf file is a definition of the virtual machine parameters depended by the template, and the output.tf file is an output value of the virtual machine information.
S3, writing the web application and the background application.
The method comprises the steps that in the writing of Web application and background application, the Web application displays lists and detailed information of virtual machines and adds and deletes operations of the virtual machines, the background application writes basic logic processing and a Provider actuator, the basic logic processing in the background application receives requests of the Web application, the Provider actuator is called according to different requests, and the Provider actuator executes a terraform command by using a java command line.
Terraform executes the command: tf files such as Terraform init initialization template information variables, tf, Terraform plan view Terraform execution plan, Terraform application execution template information, Terraform execution output Terraform execution result.
The device for managing the OpenStack virtual machine based on the Terraform comprises an OpenStack deployment module, wherein the OpenStack deployment module is used for checking an OpenStack deployment environment and deploying OpenStack.
The OpenStack deployment module is responsible for checking an OpenStack deployment environment, specifically checking whether selinux is disabled or not, checking whether a host network parameter and a public key are imported or not, checking whether a related software package is installed or not, and installing and deploying according to an OpenStack official document.
And the Terraform provider plug-in writing module is used for writing the Terraform provider plug-in.
The method for writing the Terraform provider plug-in specifically comprises the following steps: 1) installing a go language environment; 2) resource development; 3) configuring a tf file; 4) compiled into a go binary.
The Resource development comprises calling OpenStack to create an API interface, calling OpenStack to inquire the API interface, calling OpenStack to modify the API interface and calling OpenStack to delete the API interface, calling OpenStack to create the API interface, and creating a virtual machine; calling an OpenStack query API interface to realize the query of the virtual machine; calling an OpenStack modification API interface to modify the current virtual information; and calling an OpenStack deletion API interface to delete the specified virtual machine.
And the web application and background application writing module is used for writing the web application and the background application.
The Web application and background application compiling module is used for compiling the Web application and the background application, the Web application displays the list and the detailed information of the virtual machine and the operation of adding and deleting the virtual machine, the background application compiles a basic logic process and a Provider actuator, the basic logic process in the background application receives the request of the Web application, the Provider actuator is called according to different requests, and the Provider actuator executes a terrform command by using a java command line.
The above-described embodiments are merely preferred embodiments of the present invention, and general changes and substitutions by those skilled in the art within the technical scope of the present invention are included in the protection scope of the present invention.

Claims (10)

1. A method for managing OpenStack virtual machines based on Terraform is characterized by comprising the following steps: in the method, a virtual machine is created on a page, background application is carried out, and an OpenStackAPI is called by using a Terraform provider plug-in to complete the creation of the virtual machine.
2. The method for managing OpenStack virtual machines based on Terraform according to claim 1, wherein: the method specifically comprises the following steps:
s1, checking an OpenStack deployment environment, and deploying OpenStack;
s2, compiling a Terraformprovider plug-in;
s3, writing the web application and the background application.
3. The method for managing OpenStack virtual machines based on Terraform according to claim 2, wherein: in step S1, the OpenStack deployment environment is checked, specifically, whether selinux is disabled is checked, whether host network parameters, a public key are imported, whether a related software package is installed, and installation and deployment are performed according to OpenStack official documents.
4. The method for managing OpenStack virtual machines based on Terraform according to claim 3, wherein: the step S2 of writing the terrafrormplovider plug-in specifically includes the following steps: 1) installing a go language environment; 2) resource development; 3) configuring a tf file; 4) compiled into a go binary.
5. The method for managing OpenStack virtual machines based on Terraform according to claim 4, wherein: the Resource development comprises calling OpenStack to create an API interface, calling OpenStack to inquire the API interface, calling OpenStack to modify the API interface and calling OpenStack to delete the API interface, calling OpenStack to create the API interface, and creating a virtual machine; calling an OpenStack query API interface to realize the query of the virtual machine; calling an OpenStack modification API interface to modify the current virtual information; and calling an OpenStack deletion API interface to delete the specified virtual machine.
6. The method for managing OpenStack virtual machines based on Terraform according to claim 5, wherein: the configuration tf file comprises a configuration main.tf file, a variable.tf file and an output.tf file, wherein the main.tf file is a definition template of virtual machine parameters, the variable.tf file is a definition of the virtual machine parameters depended by the template, and the output.tf file is an output value of the virtual machine information.
7. The method for managing OpenStack virtual machines based on Terraform according to claim 6, wherein: the method comprises the steps that in the writing of Web application and background application, the Web application displays lists and detailed information of virtual machines and adds and deletes operations of the virtual machines, the background application writes basic logic processing and a Provider actuator, the basic logic processing in the background application receives requests of the Web application, the Provider actuator is called according to different requests, and the Provider actuator executes a terraform command by using a java command line.
8. A device for managing OpenStack virtual machine based on Terraform is characterized in that: the system comprises an OpenStack deployment module, a configuration module and a configuration module, wherein the OpenStack deployment module is used for checking an OpenStack deployment environment and deploying OpenStack;
the Terraformprovider plug-in writing module is used for writing a Terraformprovider plug-in;
and the web application and background application writing module is used for writing the web application and the background application.
9. The apparatus for managing OpenStack virtual machines based on Terraform of claim 8, wherein: the OpenStack deployment module is responsible for checking an OpenStack deployment environment, specifically checking whether selinux is disabled or not, checking whether a host network parameter and a public key are imported or not, checking whether a related software package is installed or not, and installing and deploying according to an OpenStack official document.
10. The apparatus for managing OpenStack virtual machines based on Terraform of claim 9, wherein: the Terraformprovider plug-in writing module specifically comprises the following processes: 1) installing a go language environment; 2) resource development; 3) configuring a tf file; 4) compiling into a go binary file; the Web application and background application compiling module is used for compiling the Web application and the background application, the Web application displays the list and the detailed information of the virtual machine and the operation of adding and deleting the virtual machine, the background application compiles a basic logic process and a Provider actuator, the basic logic process in the background application receives the request of the Web application, the Provider actuator is called according to different requests, and the Provider actuator executes a terrform command by using a java command line.
CN201910978841.2A 2019-10-15 2019-10-15 Method and device for managing OpenStack virtual machine based on Terraform Pending CN110704168A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910978841.2A CN110704168A (en) 2019-10-15 2019-10-15 Method and device for managing OpenStack virtual machine based on Terraform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910978841.2A CN110704168A (en) 2019-10-15 2019-10-15 Method and device for managing OpenStack virtual machine based on Terraform

Publications (1)

Publication Number Publication Date
CN110704168A true CN110704168A (en) 2020-01-17

Family

ID=69200213

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910978841.2A Pending CN110704168A (en) 2019-10-15 2019-10-15 Method and device for managing OpenStack virtual machine based on Terraform

Country Status (1)

Country Link
CN (1) CN110704168A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113472745A (en) * 2021-05-31 2021-10-01 山东英信计算机技术有限公司 Selinux-based openstack public cloud multi-tenant isolation method, system and terminal

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190122156A1 (en) * 2017-10-20 2019-04-25 International Business Machines Corporation Orchestration Engine Blueprint Milestones
CN109947537A (en) * 2019-03-28 2019-06-28 山东浪潮云信息技术有限公司 Create the system and method for cloud container service
CN110096258A (en) * 2019-04-30 2019-08-06 山东浪潮云信息技术有限公司 A method of the OpenStack infrastructure architecture management based on Terraform

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190122156A1 (en) * 2017-10-20 2019-04-25 International Business Machines Corporation Orchestration Engine Blueprint Milestones
CN109947537A (en) * 2019-03-28 2019-06-28 山东浪潮云信息技术有限公司 Create the system and method for cloud container service
CN110096258A (en) * 2019-04-30 2019-08-06 山东浪潮云信息技术有限公司 A method of the OpenStack infrastructure architecture management based on Terraform

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
KARIM ELATOV: "Deploying an OpenStack Instance with Terraform", 《HTTPS://ELATOV.GITHUB.IO/2018/09/DEPLOYING-AN-OPENSTACK-INSTANCE-WITH-TERRAFORM/》 *
WEIXIN_34393428: "Terraform Provider 开发指南", 《HTTPS://BLOG.CSDN.NET/WEIXIN_34393428/ARTICLE/DETAILS/89656300》 *
马江的博客: "opstack概述 部署安装环境 部署Opstack Opstack操作基础", 《HTTPS://BLOG.CSDN.NET/MAJIANGNB/ARTICLE/DETAILS/81735920》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113472745A (en) * 2021-05-31 2021-10-01 山东英信计算机技术有限公司 Selinux-based openstack public cloud multi-tenant isolation method, system and terminal

Similar Documents

Publication Publication Date Title
CN111147555B (en) Heterogeneous resource mixed arrangement method
US11099823B2 (en) Systems and methods for transformation of reporting schema
US8739150B2 (en) Systems and methods for dynamically replacing code objects via conditional pattern templates
US11429365B2 (en) Systems and methods for automated retrofitting of customized code objects
US8898627B2 (en) Systems and methods for applying rules to transform objects of an application
US8572566B2 (en) Systems and methods for analyzing changes in application code from a previous instance of the application code
US8706771B2 (en) Systems and methods for analyzing and transforming an application from a source installation to a target installation
US20110282995A1 (en) Systems and methods for dynamically deploying an application transformation tool over a network
CN111241454A (en) Method, system and device for generating webpage code
CN103593456A (en) Form user-defined design method and device
WO2024060725A1 (en) Aircraft tool change method and apparatus, device, and storage medium
CN115756451A (en) Method, device, equipment and storage medium for reusing multi-project code file
CN106951593B (en) Method and device for generating configuration file of protection measurement and control device
CN110704168A (en) Method and device for managing OpenStack virtual machine based on Terraform
CN109614682B (en) Method and device for FPGA pin exchange based on Expedition PCB and storage medium
CN110795431A (en) Environment monitoring data processing method, device, equipment and storage medium
CN113609101A (en) Real-time data task issuing method and device, electronic equipment and storage medium
CN110377298B (en) Distributed cluster upgrading method and distributed cluster
CN110908694A (en) Hot updating system and method for electronic bidding client application
CN102314495A (en) Method for maintaining database object
WO2011041246A1 (en) Systems and methods for analyzing and transforming an application from a source installation to a target installation
CN114064218A (en) Mirror image generation method, system, medium and application for machine learning component
CN110532000B (en) Kbroker distributed operating system for operation publishing and operation publishing system
CN107844639B (en) Project standard structure automatic generation method and system
CN102566993B (en) Method and device for editing interface

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200117