WO2023123019A1 - 云资源管理方法、装置及存储介质 - Google Patents

云资源管理方法、装置及存储介质 Download PDF

Info

Publication number
WO2023123019A1
WO2023123019A1 PCT/CN2021/142377 CN2021142377W WO2023123019A1 WO 2023123019 A1 WO2023123019 A1 WO 2023123019A1 CN 2021142377 W CN2021142377 W CN 2021142377W WO 2023123019 A1 WO2023123019 A1 WO 2023123019A1
Authority
WO
WIPO (PCT)
Prior art keywords
cloud resource
cloud
declaration
user
target
Prior art date
Application number
PCT/CN2021/142377
Other languages
English (en)
French (fr)
Inventor
林玮玥
刘梓懿
Original Assignee
深圳晶泰科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳晶泰科技有限公司 filed Critical 深圳晶泰科技有限公司
Priority to PCT/CN2021/142377 priority Critical patent/WO2023123019A1/zh
Publication of WO2023123019A1 publication Critical patent/WO2023123019A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting

Definitions

  • the present application relates to the field of software development, and in particular to a cloud resource management method, device and storage medium.
  • cloud service refers to various cloud resources provided by cloud service providers on the platform, and users obtain corresponding services through these resources.
  • a user manually writes a corresponding operation script according to a production task or manually performs cloud resource management such as creation and modification of cloud resources.
  • the above method will consume a lot of manpower and time, which is not only inefficient, but also has a high probability of error.
  • the present application provides a cloud resource management method, device and storage medium, and the technical solution can manage cloud resources efficiently and accurately.
  • the first aspect of the present application provides a cloud resource management method, including:
  • the second aspect of the present application provides a cloud resource management device, including:
  • the first response module is configured to analyze the cloud resource declaration file in response to the first operation instruction input by the user, so as to obtain the declaration information of the cloud resource;
  • the second response module is used to create a target cloud resource according to the cloud resource configuration file and the statement information of the cloud resource in response to the second operation instruction input by the user;
  • a saving module configured to save the state information of the target cloud resource to the cloud resource configuration file.
  • the third aspect of the present application provides an electronic device, including:
  • a memory on which executable codes are stored, which, when executed by the processor, cause the processor to perform the method as described above.
  • a fourth aspect of the present application provides a storage medium, on which executable code is stored, and when the executable code is executed by a processor of an electronic device, the processor is made to execute the above-mentioned method.
  • FIG. 1 is a schematic flow diagram of a cloud resource management method shown in an embodiment of the present application
  • FIG. 2 is a schematic structural diagram of a cloud resource management device shown in an embodiment of the present application
  • Fig. 3 is a schematic structural diagram of an electronic device shown in an embodiment of the present application.
  • first, second, third and so on may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another.
  • first information may also be called second information, and similarly, second information may also be called first information.
  • second information may also be called first information.
  • a feature defined as “first” and “second” may explicitly or implicitly include one or more of these features.
  • “plurality” means two or more, unless otherwise specifically defined.
  • a user manually writes a corresponding operation script according to a production task or manually performs cloud resource management such as creation and modification of cloud resources.
  • cloud resource management such as creation and modification of cloud resources.
  • the above method will consume a lot of manpower and time, which is not only inefficient, but also has a high probability of error.
  • the resources used by cloud services often need to be configured correspondingly through the application scenarios of actual production tasks.
  • a terminal needs to handle production tasks with different configuration requirements, users will use virtual machine technology to create a computer system that matches the task environment , in order to realize the operation of the task.
  • a virtual machine often builds a complete computer system, and an actual production task may not require such a complete configuration, which will lead to certain resource redundancy.
  • the embodiment of the present application provides a cloud resource management method, which can efficiently and accurately manage cloud resources.
  • FIG. 1 it is a schematic flow diagram of a cloud resource management method shown in an embodiment of the present application.
  • the method mainly includes steps S101 to S103, and the details are as follows:
  • Step S101 In response to the first operation instruction input by the user, analyze the cloud resource declaration file to obtain the declaration information of the cloud resource.
  • the technical solution of this application can be based on automated orchestration tools (such as Terraform, AWS CloudFormation, Microsoft Azure Automation, etc.), used to configure and manage infrastructure, resources and containers on the cloud.
  • automated orchestration tool constructs the resource framework on the cloud by describing the infrastructure required on the cloud and the corresponding state of the facilities, and running related creation instructions.
  • the first operation instruction input by the user may be the basic operation instruction provided by Terraform, namely terraform init.
  • the cloud resource declaration file with the suffix *tf can be downloaded from the directory storing all files with the suffix *tf and parsed to obtain the declaration information of the cloud resource. It should be noted that here, the declaration information of cloud resources should be interpreted in a broad sense.
  • the cloud resource declaration file not only defines the information of the cloud resource itself, but also declares to the cloud resource provider which supplier is required to provide cloud services or cloud resources, and the information of the cloud resource itself includes the identification of the cloud resource (name , number, etc.), the configuration of hardware resources such as CPU, memory, and disk of the cloud server, and other information, the purpose is to let the user know exactly what information is included in the cloud resources required by the statement.
  • the cloud resource declaration file may be created by the user in advance.
  • automatic orchestration tools such as Terraform provide cloud resource declaration examples, and users create cloud resource declaration files based on the provided cloud resource declaration examples, that is, write the declaration code of the cloud resource provider and the cloud server provided by the cloud resource provider.
  • Hardware resources such as CPU, memory, and disk are defined or configured. If the cloud resource provider does not provide a cloud resource creation interface, another way for users to create cloud resources is to use cloud resource declaration formatted documents such as null_resource provided by automatic orchestration tools such as Terraform. Compile the cloud resource declaration command line script in the cloud resource declaration formatting document.
  • the cloud resource declaration command line script stores a series of codes describing the steps of creating a cloud resource
  • the cloud resource declaration format document such as null_resource
  • null_resource is called in the cloud resource declaration file, that is, the file with the suffix *tf
  • null_resource can help users maintain a unified cloud resource deployment method. The reason is that if some cloud resource creation interfaces are not implemented, users often need to use the command line or manually create cloud resources, and the resource configuration file These cloud resource information created outside of terraform will not be recorded, which brings inconvenience to resource management.
  • Step S102 In response to the second operation instruction input by the user, create a target cloud resource according to the cloud resource configuration file and the statement information of the cloud resource.
  • the cloud resource configuration file is first introduced here.
  • the cloud resource configuration file is a file that saves the status information of the cloud resources declared in the cloud resource declaration file, where the status information of the cloud resources describes the parameters and corresponding values of the successfully created cloud resources. From the definition of the cloud resource configuration file, it can be seen that the cloud resource configuration file is a record file generated according to the cloud resource declaration file, which means that the cloud resource configuration file only saves the state of the cloud resource declared by the cloud resource declaration file and successfully created information. If a cloud resource has not been declared in the cloud resource declaration file, or, although the cloud resource has been declared in the cloud resource declaration file, but the creation of the cloud resource has not been successful, the cloud resource The configuration file does not save the status information of the cloud resource.
  • the second operation instruction input by the user may be a basic operation instruction such as terraform plan or terraform apply provided by Terraform.
  • a basic operation instruction such as terraform plan or terraform apply provided by Terraform.
  • the target cloud resource can be created according to the cloud resource configuration file and the declaration information of the cloud resource.
  • creating the target cloud resource according to the cloud resource configuration file and the declaration information of the cloud resource may be: in response to the second operation instruction input by the user, obtaining the cloud resource configuration file State information of the cloud resource and statement information of the cloud resource; in response to the user's confirmation of creating the target cloud resource, the target cloud resource is created, wherein the statement information of the cloud resource includes a statement of the target cloud resource.
  • the terraform apply command nests the terraform plan command, when the user enters the terraform apply command, the terraform plan is actually executed in advance, and when the user only enters the terraform plan, the follow-up needs to Enter the terraform apply command to complete the creation of the target cloud resource.
  • the user when the user enters terraform plan, as a response to the instruction terraform plan, the status information of the cloud resources and the statement information of the cloud resources in the cloud resource configuration file are obtained, and the status of the cloud resources in the cloud resource configuration file is previewed
  • the user can know how the cloud resource will change when Terraform executes the terraform apply command, so that the user can make a decision whether to update the cloud resource; when the user decides to update the cloud resource,
  • the user enters terraform apply, and as a response to the instruction of terraform apply entered by the user, the automatic creation of target cloud resources starts.
  • the above is to enter the terraform plan and terraform apply commands in sequence.
  • terraform apply is nested with terraform plan
  • Terraform executes the terraform plan command as a response to the command terraform apply, and displays the status information and declaration information of cloud resources in the cloud resource configuration file.
  • the creation of the target cloud resource starts.
  • the user only needs to enter the command terraform apply after typing terraform init to realize the automatic creation of target cloud resources.
  • creating the target cloud resource may be: in response to the user's confirmation of creating the target cloud resource, calling the cloud resource creation interface to automatically create the target cloud resource.
  • the user's confirmation of creating the target cloud resource can be based on the status information of the cloud resource in the cloud resource configuration file displayed after the execution of the terraform plan and the cloud The statement information of the resource, and then enter the command terraform apply, or the user can directly enter the command terraform apply, and when the status information of the cloud resource and the statement information of the cloud resource in the cloud resource configuration file are displayed later, in the command line window Type "yes" directly.
  • Step S103 Save the state information of the target cloud resource to the cloud resource configuration file.
  • the state information of the target cloud resource can be saved in the cloud resource configuration file.
  • the present application also includes displaying the state information of the cloud resource and the statement information of the cloud resource in the obtained cloud resource configuration file; before creating the target cloud resource, detecting whether the target cloud resource has been manually created; If the target cloud resource has been created manually, in response to the user's confirmation of creating the target cloud resource, a prompt message of cloud resource creation failure is returned.
  • the cloud resource configuration files will not save their state information. For example, the user manually creates cloud resource A on the cloud, and declares the manually created cloud resource A in the cloud resource declaration file.
  • Terraform When the user uses the terraform apply command to create cloud resource A again, because there is no status information of cloud resource A in the cloud resource configuration file, Terraform prompts that cloud resource A needs to be added.
  • Terraform detects that cloud resource A has been manually created, and returns a message that the creation of cloud resource A failed. Since the cloud resource A is not automatically created successfully, the resource configuration file does not save the state information of the cloud resource A.
  • the cloud resource declaration file can be created in advance. Therefore, the above-mentioned embodiment of the present application may also include providing a cloud resource declaration example, so that the user can create a cloud resource declaration file according to the cloud resource declaration example, or, the above-mentioned implementation of the present application The example may also include providing an interface for creating a cloud resource declaration file, so that the user compiles a cloud resource declaration command line script in the cloud resource declaration file creation interface.
  • the first operation instruction and/or the second operation instruction in the above-mentioned embodiment of the present application may be input through a command window.
  • the present application also provides a cloud resource management device, electronic equipment, and corresponding embodiments.
  • FIG. 2 it is a schematic structural diagram of a cloud resource management device shown in an embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
  • the apparatus illustrated in FIG. 2 may include a first response module 201, a second response module 202 and a storage module 203, which are described as follows:
  • the first response module 201 is configured to analyze the cloud resource declaration file in response to the first operation instruction input by the user, so as to obtain the declaration information of the cloud resource;
  • the second response module 202 is configured to create a target cloud resource according to the cloud resource configuration file and the statement information of the cloud resource in response to a second operation instruction input by the user;
  • the saving module 203 is configured to save the state information of the target cloud resource to a cloud resource configuration file.
  • the second response module 202 illustrated in FIG. 2 may include an acquisition unit and a resource creation unit, wherein:
  • the acquiring unit is configured to, in response to the second operation instruction input by the user, acquire the state information of the cloud resource and the declaration information of the cloud resource in the cloud resource configuration file, wherein the declaration information of the cloud resource includes a declaration of the target cloud resource;
  • a resource creation unit configured to create the target cloud resource in response to the user's confirmation of creating the target cloud resource.
  • the resource creation unit in the above example may include a calling unit, configured to call the cloud resource creation interface to automatically create the target cloud resource in response to the user's confirmation of creating the target cloud resource.
  • the device illustrated in FIG. 2 may also include a display module, a detection module, and a return module, wherein:
  • a display module configured to display the state information of the cloud resource and the declaration information of the cloud resource in the acquired cloud resource configuration file
  • a detection module configured to detect whether the target cloud resource has been manually created before creating the target cloud resource
  • the return module is configured to return the cloud resource creation failure prompt message in response to the user's confirmation of creating the target cloud resource if the target cloud resource has been manually created.
  • the first operation instruction and/or the second operation instruction in the above examples are input through a command window.
  • the device illustrated in FIG. 2 may further include a declaration example providing module, configured to provide a cloud resource declaration example, so that the user can create a cloud resource declaration file according to the cloud resource declaration example.
  • a declaration example providing module configured to provide a cloud resource declaration example, so that the user can create a cloud resource declaration file according to the cloud resource declaration example.
  • the device illustrated in FIG. 2 may further include a format document providing module, configured to provide a cloud resource declaration formatted document, so that users can compile cloud resource declaration command line scripts in the cloud resource declaration formatted document.
  • a format document providing module configured to provide a cloud resource declaration formatted document, so that users can compile cloud resource declaration command line scripts in the cloud resource declaration formatted document.
  • the creation of the target cloud resource can be realized by parsing the resource declaration file only by inputting two operation commands by the user.
  • this application only requires users to perform simple operations to automatically create cloud resources. Since there is no need for complicated work, the probability of errors is also reduced. .
  • the technical solution of the present application has the advantages of high efficiency and accuracy in cloud resource management.
  • the electronic device 300 includes a memory 310 and a processor 320 .
  • the processor 320 can be a central processing unit (Central Processing Unit, CPU), and can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), on-site Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the memory 310 may include various types of storage units, such as system memory, read only memory (ROM), and persistent storage.
  • the ROM may store static data or instructions required by the processor 320 or other modules of the computer.
  • the persistent storage device may be a readable and writable storage device.
  • Persistent storage may be a non-volatile storage device that does not lose stored instructions and data even if the computer is powered off.
  • the permanent storage device adopts a mass storage device (such as a magnetic or optical disk, flash memory) as the permanent storage device.
  • the permanent storage device may be a removable storage device (such as a floppy disk, an optical drive).
  • the system memory can be a readable and writable storage device or a volatile readable and writable storage device, such as dynamic random access memory.
  • System memory can store some or all of the instructions and data that the processor needs at runtime.
  • memory 310 may include any combination of computer-readable storage media, including various types of semiconductor memory chips (DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), and magnetic and/or optical disks may also be used.
  • memory 310 may include a readable and/or writable removable storage device, such as a compact disc (CD), a read-only digital versatile disc (e.g., DVD-ROM, dual-layer DVD-ROM), Read-Only Blu-ray Disc, Super Density Disc, Flash memory card (such as SD card, min SD card, Micro-SD card, etc.), magnetic floppy disk, etc.
  • a readable and/or writable removable storage device such as a compact disc (CD), a read-only digital versatile disc (e.g., DVD-ROM, dual-layer DVD-ROM), Read-Only Blu-ray Disc, Super Density Disc, Flash memory card (such as SD card, min SD card, Micro-SD card, etc.), magnetic floppy disk, etc.
  • Computer-readable storage media do not contain carrier waves and transient electronic signals transmitted by wireless or wire.
  • Executable codes are stored in the memory 310 , and when the executable codes are processed by the processor 320 , the processor 320 can be made to execute part or all of the methods mentioned above.
  • the method according to the present application can also be implemented as a computer program or computer program product, the computer program or computer program product including computer program code instructions for executing some or all of the steps in the above method of the present application.
  • the present application may also be implemented as a storage medium, including a non-transitory machine-readable storage medium, a computer-readable storage medium, or a machine-readable storage medium, on which executable code (or computer program, or computer instruction) is stored. code), when the executable code (or computer program, or computer instruction code) is executed by the processor of the electronic device (or electronic device, server, etc.), causing the processor to perform part or part of each step of the above-mentioned method according to the present application all.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

本申请是关于一种云资源管理方法、装置及存储介质,所述方法包括:响应于用户输入的第一操作指令,对云资源声明文件进行解析,以获取云资源的声明信息;响应于用户输入的第二操作指令,根据云资源配置文件和云资源的声明信息创建目标云资源;将目标云资源的状态信息保存至云资源配置文件。本申请的技术方案能够高效、准确地对云资源进行管理。

Description

云资源管理方法、装置及存储介质 技术领域
本申请涉及软件开发领域,尤其涉及一种云资源管理方法、装置及存储介质。
背景技术
随着大数据时代计算任务的增加,生产机构的硬件资源可能无法满足海量的数据结构、数量的快速增长以及数据结构不断变化的需求,因此,云服务应运而生。所谓云服务,是云服务的提供商在平台上提供的各种云资源,用户通过这些资源获取相应的服务。相关技术中,一般是用户根据生产任务手动编写对应的操作脚本或手动操作进行云资源的创建、变更等云资源管理工作。然而,随着生产任务的成倍增长,上述方式将耗费大量的人力和时间,不仅效率低下,而且出错概率较高。
发明内容
为解决或部分解决相关技术中存在的问题,本申请提供一种云资源管理方法、装置及存储介质,该技术方案能够高效、准确地对云资源进行管理。
本申请第一方面提供一种云资源管理方法,包括:
响应于用户输入的第一操作指令,对云资源声明文件进行解析,以获取云资源的声明信息;
响应于用户输入的第二操作指令,根据云资源配置文件和所述云资源的声明信息创建目标云资源;
将所述目标云资源的状态信息保存至所述云资源配置文件。
本申请第二方面提供一种云资源管理装置,包括:
第一响应模块,用于响应于用户输入的第一操作指令,对云资源声明文件进行解析,以获取云资源的声明信息;
第二响应模块,用于响应于用户输入的第二操作指令,根据云资源配 置文件和所述云资源的声明信息创建目标云资源;
保存模块,用于将所述目标云资源的状态信息保存至所述云资源配置文件。
本申请第三方面提供一种电子设备,包括:
处理器;以及
存储器,其上存储有可执行代码,当所述可执行代码被所述处理器执行时,使所述处理器执行如上所述的方法。
本申请第四方面提供一种存储介质,其上存储有可执行代码,当所述可执行代码被电子设备的处理器执行时,使所述处理器执行如上所述的方法。
从上述本申请提供的技术方案可知,只需要用户输入两个操作命令,即可通过对资源声明文件的解析,实现对目标云资源的创建。相比于相关技术需要用户进行大量手动操作才能创建云资源耗费的人力成本,本申请只需要用户进行简单的操作即可自动创建云资源,由于无需进行繁杂的工作,因此也降低了出错的概率。综上,本申请的技术方案在云资源管理方面存在高效、准确的优势。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本申请。
附图说明
通过结合附图对本申请示例性实施方式进行更详细的描述,本申请的上述以及其它目的、特征和优势将变得更加明显,其中,在本申请示例性实施方式中,相同的参考标号通常代表相同部件。
图1是本申请实施例示出的云资源管理方法的流程示意图;
图2是本申请实施例示出的云资源管理装置的结构示意图;
图3是本申请实施例示出的电子设备的结构示意图。
具体实施方式
下面将参照附图更详细地描述本申请的实施方式。虽然附图中显示了本申请的实施方式,然而应该理解,可以以各种形式实现本申请而不应被 这里阐述的实施方式所限制。相反,提供这些实施方式是为了使本申请更加透彻和完整,并且能够将本申请的范围完整地传达给本领域的技术人员。
在本申请使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。
应当理解,尽管在本申请可能采用术语“第一”、“第二”、“第三”等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本申请范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本申请的描述中,“多个”的含义是两个或两个以上,除非另有明确具体的限定。
在云资源管理的相关技术中,一般是用户根据生产任务手动编写对应的操作脚本或手动操作进行云资源的创建、变更等云资源管理工作。然而,随着生产任务的成倍增长,上述方式将耗费大量的人力和时间,不仅效率低下,而且出错概率较高。此外,云服务使用的资源常常需要通过实际生产任务的应用场景进行对应的配置,当一台终端需要处理不同配置需求的生产任务时,用户会使用虚拟机技术创建出一个匹配任务环境的计算机系统,以实现任务的运行。然而,虚拟机往往会构建一个完整的计算机系统,而实际一个生产任务可能并不需要如此完整的配置,这就会导致一定的资源冗余。
针对上述问题,本申请实施例提供一种云资源管理方法,能够高效、准确地对云资源进行管理。
以下结合附图详细描述本申请实施例的技术方案。
参见图1,是本申请实施例示出的云资源管理方法的流程示意图,该方法主要包括步骤S101至步骤S103,详细说明如下:
步骤S101:响应于用户输入的第一操作指令,对云资源声明文件进行解析,以获取云资源的声明信息。
如前所述,尽管在云资源管理这种业务中,用户会使用虚拟机技术创建出一个匹配任务环境的计算机系统,以实现任务的运行。然而,虚拟机往往会构建一个完整的计算机系统,而实际一个生产任务可能并不需要如此完整的配置,这就会导致一定的资源冗余。为了解决这个问题,本申请的技术方案可以基于自动化编排工具(例如Terraform、AWS CloudFormation、Microsoft Azure Automation,等等),用于配置和管理云上基础架构、资源和容器等。具体而言,自动化编排工具通过描述云上需要的基础设施及设施的对应状态、并运行相关的创建指令,构建出云上的资源框架。使用自动化编排工具实现了云上资源管理的代码化,而不需要在云服务供应商的网页处手动去创建,既节省了一定的手动操作时间,也减少了人工操作可能产生的错误,同时通过代码化可以更好地帮助云上资源管理。
在本申请实施例中,以上述实施例的自动化编排工具是Terraform为例,用户输入的第一操作指令可以是Terraform提供的基础操作指令即terraform init。作为对terraform init这一操作指令的响应,可以从保存所有后缀名为*tf的文件目录下载后缀名为*tf的云资源声明文件并进行解析,以获取云资源的声明信息。需要说明的是,此处,云资源的声明信息是应当做广义解释。换言之,云资源声明文件不仅定义了云资源本身的信息,还对云资源提供商进行了声明即需要哪个供应商提供云服务或云资源,而云资源本身的信息则包含云资源的标识(名称、编号等)、云服务器的CPU、内存和磁盘等硬件资源的配置等信息,目的在于使用户明确获知其声明需要的云资源包含哪些信息。
需要说明的是,云资源声明文件可以由用户事先创建。一种方法是Terraform等自动化编排工具提供云资源声明示例,用户根据提供的云资源声明示例创建云资源声明文件,即编写云资源提供商的声明代码以及对该云资源提供商提供的云服务器的CPU、内存和磁盘等硬件资源进行定义或配置。若云资源提供商未提供云资源创建接口,则用户创建云资源的另一种方式是使用Terraform等自动化编排工具提供的null_resource等云资源声明格式化文档,用户按照null_resource的示例代码,在null_resource等云资源声明格式化文档中编撰云资源声明命令行脚本。由于云资源声明 命令行脚本是存放一串描述创建云资源这一步骤的命令的代码,因此,当在云资源声明文件即后缀为*tf的文件中调用null_resource等云资源声明格式化文档时,相当于执行该云资源声明命令行脚本中的命令,实现对云资源的创建。实际上,使用null_resource可以帮助用户保持云资源部署方法的统一,其原因在于,若某些云资源创建接口未实现,用户往往需要使用命令行或手动的方式进行云资源的创建,而资源配置文件并不会记录这些在terraform以外创建的云资源信息,由此给资源管理带来不便。
步骤S102:响应于用户输入的第二操作指令,根据云资源配置文件和云资源的声明信息创建目标云资源。
此处首先对云资源配置文件进行介绍。云资源配置文件是一个保存云资源声明文件中声明的云资源的状态信息的文件,此处的云资源的状态信息描述了创建成功的云资源的各个参数及其对应的值。从云资源配置文件的定义可知,云资源配置文件是根据云资源声明文件而生成的一种记录文件,这意味着云资源配置文件只是保存经过云资源声明文件声明并且创建成功的云资源的状态信息。若某个云资源尚未在云资源声明文件中进行声明,或者,虽然在云资源声明文件中对该某个云资源进行了声明,但创建该某个云资源时却并没有成功,则云资源配置文件不会对该某个云资源的状态信息进行保存。
在本申请实施例中,用户输入的第二操作指令可以是Terraform提供的terraform plan或terraform apply等基础操作指令。作为对用户输入的terraform plan或terraform apply这一基础操作指令的响应,可以根据云资源配置文件和云资源的声明信息创建目标云资源。作为本申请一个实施例,响应于用户输入的第二操作指令,根据云资源配置文件和云资源的声明信息创建目标云资源可以是:响应于用户输入的第二操作指令,获取云资源配置文件中云资源的状态信息和云资源的声明信息;响应于用户对创建目标云资源的确认,创建目标云资源,其中,云资源的声明信息包括对目标云资源的声明。此处需要说明的是,由于terraform apply指令嵌套了terraform plan这一指令,因此,当用户输入terraform apply指令时,实际上事先执行了terraform plan,而当用户只是输入terraform plan时,后续还需要输入terraform apply指令才能完成对目标云资源的创建。具体而言, 当用户输入terraform plan时,作为对terraform plan这一指令的响应,获取云资源配置文件中云资源的状态信息和云资源的声明信息,通过预览云资源配置文件中云资源的状态信息和云资源的声明信息之间的差异,用户可以获知当Terraform执行terraform apply指令时,云资源将发生怎样的变化,以便用户做出是否更新云资源的决定;当用户决定更新云资源时,用户输入terraform apply,作为对用户输入的terraform apply这一指令的响应,开始自动创建目标云资源。以上是依次输入terraform plan和terraform apply指令。若terraform apply嵌套terraform plan,则当用户输入terraform apply时,作为对terraform apply这一指令的响应,Terraform执行terraform plan指令,显示云资源配置文件中云资源的状态信息和云资源的声明信息,当用户对创建目标云资源进行确认(在命令行窗口直接输入“yes”),则开始创建目标云资源。换言之,若terraform apply嵌套terraform plan,则只需要用户在输入terraform init之后输入terraform apply这一指令,即可实现对目标云资源的自动创建。
Terraform等自动化编排工具提供了丰富的接口,其中包括云资源创建接口。因此,作为本申请一个实施例,响应于用户对创建目标云资源的确认,创建目标云资源可以是:响应于用户对创建目标云资源的确认,调用云资源创建接口自动创建目标云资源。按照前述实施例的描述,此处用户对创建目标云资源的确认,既可以是用户在输入terraform plan这一指令后,根据执行terraform plan后显示的云资源配置文件中云资源的状态信息和云资源的声明信息,再输入terraform apply这一指令,又可以是用户直接输入terraform apply这一指令,在随后显示云资源配置文件中云资源的状态信息和云资源的声明信息时,在命令行窗口直接输入“yes”。
步骤S103:将目标云资源的状态信息保存至云资源配置文件。
由于目标云资源已经在云资源声明文件中声明并且成功自动创建,按照对云资源配置文件的定义,可以将该目标云资源的状态信息保存至云资源配置文件。
在上述本申请实施例提供的方法中,还包括显示获取的云资源配置文件中云资源的状态信息和云资源的声明信息;在创建目标云资源之前,检测目标云资源是否已经通过手动创建;若目标云资源已经通过手动创建, 则响应于用户对创建目标云资源的确认,返回云资源创建失败提示信息。按照前述对云资源配置文件的定义,对于自动创建失败的云资源,云资源配置文件将不会保存其状态信息。例如,用户手动在云上创建了云资源A,又在云资源声明文件中声明对手动创建的云资源A进行了声明。当用户使用terraform apply指令欲再次创建云资源A时,由于云资源配置文件中没有云资源A的状态信息,Terraform提示需要新增云资源A。当执行terraform apply指令时,Terraform检测到已手动创建云资源A,则返回云资源A创建失败提示信息。由于云资源A并没有成功自动创建,资源配置文件并不对云资源A进行状态信息的保存。
如前所述,云资源声明文件可事先进行创建,因此,上述本申请实施例还可以包括提供云资源声明示例,以使用户根据云资源声明示例创建云资源声明文件,或者,上述本申请实施例还可以包括提供云资源声明文件创建接口,以使用户在云资源声明文件创建接口中编撰云资源声明命令行脚本。此外,上述本申请实施例的第一操作指令和/或第二操作指令可通过命令窗口输入。
从上述图1示例的技术方案可知,只需要用户输入两个操作命令,即可通过对资源声明文件的解析,实现对目标云资源的创建。相比于相关技术需要用户进行大量手动操作才能创建云资源耗费的人力成本,本申请只需要用户进行简单的操作即可自动创建云资源,由于无需进行繁杂的工作,因此也降低了出错的概率。综上,本申请的技术方案在云资源管理方面存在高效、准确的优势。
与前述应用功能实现方法实施例相对应,本申请还提供了一种云资源管理装置、电子设备及相应的实施例。
参见图2是本申请实施例示出的云资源管理装置的结构示意图。为了便于说明,仅仅示出与本申请实施例相关的部分。图2示例的装置可以包括第一响应模块201、第二响应模块202和保存模块203,说明如下:
第一响应模块201,用于响应于用户输入的第一操作指令,对云资源声明文件进行解析,以获取云资源的声明信息;
第二响应模块202,用于响应于用户输入的第二操作指令,根据云资源配置文件和云资源的声明信息创建目标云资源;
保存模块203,用于将目标云资源的状态信息保存至云资源配置文件。
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不再做详细阐述说明。
可选地,图2示例的第二响应模块202可以包括获取单元和资源创建单元,其中:
获取单元,用于响应于用户输入的第二操作指令,获取云资源配置文件中云资源的状态信息和云资源的声明信息,其中,云资源的声明信息包括对目标云资源的声明;
资源创建单元,用于响应于用户对创建目标云资源的确认,创建目标云资源。
可选地,上述示例的资源创建单元可以包括调用单元,用于响应于用户对创建目标云资源的确认,调用云资源创建接口自动创建目标云资源。
可选地,图2示例的装置还可以包括显示模块、检测模块和返回模块,其中:
显示模块,用于显示获取的云资源配置文件中云资源的状态信息和云资源的声明信息;
检测模块,用于在创建所述目标云资源之前,检测目标云资源是否已经通过手动创建;
返回模块,用于若目标云资源已经通过手动创建,则响应于用户对创建目标云资源的确认,返回云资源创建失败提示信息。
可选地,上述示例的第一操作指令和/或第二操作指令通过命令窗口输入。
可选地,图2示例的装置还可以包括声明示例提供模块,用于提供云资源声明示例,以使用户根据云资源声明示例创建云资源声明文件。
可选地,图2示例的装置还可以包括格式文档提供模块,用于提供云资源声明格式化文档,以使用户在云资源声明格式化文档中编撰云资源声明命令行脚本。
从图2示例的装置可知,只需要用户输入两个操作命令,即可通过对资源声明文件的解析,实现对目标云资源的创建。相比于相关技术需要用户进行大量手动操作才能创建云资源耗费的人力成本,本申请只需要用户 进行简单的操作即可自动创建云资源,由于无需进行繁杂的工作,因此也降低了出错的概率。综上,本申请的技术方案在云资源管理方面存在高效、准确的优势。
参见图3,是本申请实施例示出的电子设备的结构示意图。该电子设备300包括存储器310和处理器320。
处理器320可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
存储器310可以包括各种类型的存储单元,例如系统内存、只读存储器(ROM),和永久存储装置。其中,ROM可以存储处理器320或者计算机的其他模块需要的静态数据或者指令。永久存储装置可以是可读写的存储装置。永久存储装置可以是即使计算机断电后也不会失去存储的指令和数据的非易失性存储设备。在一些实施方式中,永久性存储装置采用大容量存储装置(例如磁或光盘、闪存)作为永久存储装置。另外一些实施方式中,永久性存储装置可以是可移除的存储设备(例如软盘、光驱)。系统内存可以是可读写存储设备或者易失性可读写存储设备,例如动态随机访问内存。系统内存可以存储一些或者所有处理器在运行时需要的指令和数据。此外,存储器310可以包括任意计算机可读存储媒介的组合,包括各种类型的半导体存储芯片(DRAM,SRAM,SDRAM,闪存,可编程只读存储器),磁盘和/或光盘也可以采用。在一些实施方式中,存储器310可以包括可读和/或写的可移除的存储设备,例如激光唱片(CD)、只读数字多功能光盘(例如DVD-ROM,双层DVD-ROM)、只读蓝光光盘、超密度光盘、闪存卡(例如SD卡、min SD卡、Micro-SD卡等等)、磁性软盘等等。计算机可读存储媒介不包含载波和通过无线或有线传输的瞬间电子信号。
存储器310上存储有可执行代码,当可执行代码被处理器320处理时,可以使处理器320执行上文述及的方法中的部分或全部。
此外,根据本申请的方法还可以实现为一种计算机程序或计算机程序产品,该计算机程序或计算机程序产品包括用于执行本申请的上述方法中部分或全部步骤的计算机程序代码指令。
或者,本申请还可以实施为一种存储介质,包括非暂时性机器可读存储介质、计算机可读存储介质或机器可读存储介质,其上存储有可执行代码(或计算机程序、或计算机指令代码),当可执行代码(或计算机程序、或计算机指令代码)被电子设备(或电子设备、服务器等)的处理器执行时,使处理器执行根据本申请的上述方法的各个步骤的部分或全部。
以上已经描述了本申请的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。

Claims (16)

  1. 一种云资源管理方法,其特征在于,所述方法包括:
    响应于用户输入的第一操作指令,对云资源声明文件进行解析,以获取云资源的声明信息;
    响应于用户输入的第二操作指令,根据云资源配置文件和所述云资源的声明信息创建目标云资源;
    将所述目标云资源的状态信息保存至所述云资源配置文件。
  2. 根据权利要求1所述的云资源管理方法,其特征在于,所述响应于用户输入的第二操作指令,根据云资源配置文件和所述云资源的声明信息创建目标云资源,包括:
    响应于用户输入的第二操作指令,获取所述云资源配置文件中云资源的状态信息和所述云资源的声明信息,所述云资源的声明信息包括对所述目标云资源的声明;
    响应于所述用户对创建所述目标云资源的确认,创建所述目标云资源。
  3. 根据权利要求2所述的云资源管理方法,其特征在于,所述响应于所述用户对创建所述目标云资源的确认,创建所述目标云资源,包括:
    响应于所述用户对创建所述目标云资源的确认,调用云资源创建接口自动创建所述目标云资源。
  4. 根据权利要求2所述的云资源管理方法,其特征在于,所述方法还包括:
    显示所述获取的云资源配置文件中云资源的状态信息和云资源的声明信息;
    在创建所述目标云资源之前,检测所述目标云资源是否已经通过手动创建;
    若所述目标云资源已经通过手动创建,则响应于所述用户对创建所述目标云资源的确认,返回云资源创建失败提示信息。
  5. 根据权利要求1至4任意一项所述的云资源管理方法,其特征在于,所述第一操作指令和/或第二操作指令通过命令窗口输入。
  6. 根据权利要求1至4任意一项所述的云资源管理方法,其特征在于,所述方法还包括:
    提供云资源声明示例,以使所述用户根据所述云资源声明示例创建所述云资源声明文件。
  7. 根据权利要求1至4任意一项所述的云资源管理方法,其特征在于,所述方法还包括:
    提供云资源声明格式化文档,以使所述用户在所述云资源声明格式化文档中编撰云资源声明命令行脚本。
  8. 一种云资源管理装置,其特征在于,所述装置包括:
    第一响应模块,用于响应于用户输入的第一操作指令,对云资源声明文件进行解析,以获取云资源的声明信息;
    第二响应模块,用于响应于所述用户输入的第二操作指令,根据云资源配置文件和所述云资源的声明信息创建目标云资源;
    保存模块,用于将所述目标云资源的状态信息保存至所述云资源配置文件。
  9. 根据权利要求8所述的云资源管理装置,其特征在于,所述第二响应模块包括:
    获取单元,用于响应于所述用户输入的第二操作指令,获取所述云资源配置文件中云资源的状态信息和云资源的声明信息,所述云资源的声明信息包括对所述目标云资源的声明;
    资源创建单元,用于响应于所述用户对创建所述目标云资源的确认,创建所述目标云资源。
  10. 根据权利要求9所述的云资源管理装置,其特征在于,所述资源创建单元包括:
    调用单元,用于响应于所述用户对创建所述目标云资源的确认,调用云资源创建接口自动创建目标云资源。
  11. 根据权利要求8所述的云资源管理装置,其特征在于,所述装置还包括:
    显示模块,用于显示获取的云资源配置文件中云资源的状态信息和云资源的声明信息;
    检测模块,用于在创建所述目标云资源之前,检测所述目标云资源是否已经通过手动创建;
    返回模块,用于若所述目标云资源已经通过手动创建,则响应于用户对创建所述目标云资源的确认,返回云资源创建失败提示信息。
  12. 根据权利要求8至11任意一项所述的云资源管理装置,其特征在于,所述第一操作指令和/或第二操作指令通过命令窗口输入。
  13. 根据权利要求8至11任意一项所述的云资源管理装置,其特征在于,所以装置还包括声明示例提供模块,用于提供云资源声明示例,以使所述用户根据云资源声明示例创建云资源声明文件。
  14. 根据权利要求8至11任意一项所述的云资源管理装置,其特征在于,所以装置还包括格式文档提供模块,用于提供云资源声明格式化文档,以使所述用户在所述云资源声明格式化文档中编撰云资源声明命令行脚本。
  15. 一种电子设备,其特征在于,包括:
    处理器;以及
    存储器,其上存储有可执行代码,当所述可执行代码被所述处理器执行时,使所述处理器执行如权利要求1至7中任一项所述的方法。
  16. 一种存储介质,其上存储有可执行代码,当所述可执行代码被电子设备的处理器执行时,使所述处理器执行如权利要求1至7中任一项所述的方法。
PCT/CN2021/142377 2021-12-29 2021-12-29 云资源管理方法、装置及存储介质 WO2023123019A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/142377 WO2023123019A1 (zh) 2021-12-29 2021-12-29 云资源管理方法、装置及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/142377 WO2023123019A1 (zh) 2021-12-29 2021-12-29 云资源管理方法、装置及存储介质

Publications (1)

Publication Number Publication Date
WO2023123019A1 true WO2023123019A1 (zh) 2023-07-06

Family

ID=86996810

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/142377 WO2023123019A1 (zh) 2021-12-29 2021-12-29 云资源管理方法、装置及存储介质

Country Status (1)

Country Link
WO (1) WO2023123019A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170237679A1 (en) * 2014-07-31 2017-08-17 Hewlett Packard Enterprise Development Lp Cloud resource pool
CN107070705A (zh) * 2017-03-23 2017-08-18 无锡华云数据技术服务有限公司 一种云资源的编排方法
US20170371628A1 (en) * 2016-06-22 2017-12-28 EMC IP Holding Company LLC Method and device of resource orchestration using an object-oriented language
CN111769979A (zh) * 2020-06-19 2020-10-13 苏州浪潮智能科技有限公司 一种云资源编排方法、系统、终端及存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170237679A1 (en) * 2014-07-31 2017-08-17 Hewlett Packard Enterprise Development Lp Cloud resource pool
US20170371628A1 (en) * 2016-06-22 2017-12-28 EMC IP Holding Company LLC Method and device of resource orchestration using an object-oriented language
CN107070705A (zh) * 2017-03-23 2017-08-18 无锡华云数据技术服务有限公司 一种云资源的编排方法
CN111769979A (zh) * 2020-06-19 2020-10-13 苏州浪潮智能科技有限公司 一种云资源编排方法、系统、终端及存储介质

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ANONYMOUS: "[Terraform] Cloud Infrastructure Creation-Azure Resource Group_Qingcheng Programmer Stone's Blog-CSDN Blog", 19 October 2021 (2021-10-19), XP093075773, Retrieved from the Internet <URL:https://blog.csdn.net/DynmicResource/article/details/120863876> *

Similar Documents

Publication Publication Date Title
CN111428462B (zh) 通讯协议模板构建的方法及终端设备
WO2020233037A1 (zh) 数据处理方法、装置及存储介质
US8832125B2 (en) Extensible event-driven log analysis framework
US11561889B2 (en) Orchestration for automated performance testing
CN110515795B (zh) 一种大数据组件的监控方法、装置、电子设备
CN108241720B (zh) 数据处理方法、装置和计算机可读存储介质
US20240069877A1 (en) Method and device for generating application based on android system, and storage medium
CN115328853A (zh) 一种基于autosar的文件配置方法及装置
US9779014B2 (en) Resilient mock object creation for unit testing
CN115357289A (zh) 寄存器应用信息生成方法、装置、电子设备和存储介质
US20210026756A1 (en) Deriving software application dependency trees for white-box testing
US20150020056A1 (en) Methods and systems for file processing
WO2023123019A1 (zh) 云资源管理方法、装置及存储介质
CN110806891B (zh) 嵌入式设备软件版本的生成方法及装置
US11262986B2 (en) Automatic software generation for computer systems
CN111400245B (zh) 美术资源迁移方法及装置
CN115687075A (zh) 页面测试脚本的纠错方法及装置
CN114791884A (zh) 测试环境的构建方法、装置、存储介质及电子设备
CN111813659A (zh) 基于ui和接口自动化测试方法、装置、设备及可读介质
CN114296926A (zh) 云资源管理方法、装置及存储介质
CN112559444A (zh) Sql文件迁移方法、装置、存储介质及设备
US9280441B2 (en) Detection and correction of race conditions in workflows
CN115857900B (zh) 代码自动生成方法、装置、电子设备及存储介质
WO2023102869A1 (zh) 任务管理系统、方法、装置、设备及存储介质
US20240235944A9 (en) Cloud migration data analysis method using system process information, and system thereof

Legal Events

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

Ref document number: 21969394

Country of ref document: EP

Kind code of ref document: A1