在包含Orchestration服务的环境中,可以创建启动实例的堆栈

创建yam文件

heat_template_version: 2015-10-15
description: Launch a basic instance with CirrOS image using the
``m1.tiny`` flavor, ``mykey`` key, and one network. parameters:
NetID:
type: string
description: Network ID to use for the instance. resources:
server:
type: OS::Nova::Server
properties:
image: cirros_test
flavor: m1.tiny
key_name: demo
networks:
- network: { get_param: NetID } outputs:
instance_name:
description: Name of the instance.
value: { get_attr: [ server, name ] }
instance_ip:
description: IP address of the instance.
value: { get_attr: [ server, first_address ] }
[root@armstrong ~]# source keystone_demo
注意,yam文件里的image,flavor,key_name可以利用openstack CLI获取
[root@armstrong ~(keystone_demo)]# openstack flavor list
+----+-----------+-------+------+-----------+-------+-----------+
| ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+-----------+-------+------+-----------+-------+-----------+
| | m1.tiny | | | | | True |
| | m1.small | | | | | True |
| | m1.medium | | | | | True |
| | m1.large | | | | | True |
| | m1.xlarge | | | | | True |
+----+-----------+-------+------+-----------+-------+-----------+
[root@armstrong ~(keystone_demo)]# openstack image list
+--------------------------------------+----------------+--------+
| ID | Name | Status |
+--------------------------------------+----------------+--------+
| 9d3a6eba-2e28-422c-950a-d62240a14257 | cirros_test | active |
| 9fee7ec6-6cce-4df0--c9d94153fb98 | test_armstrong | active |
+--------------------------------------+----------------+--------+
[root@armstrong ~(keystone_demo)]# openstack keypair create demo
[root@armstrong ~(keystone_demo)]# openstack keypair list
+------+-------------------------------------------------+
| Name | Fingerprint |
+------+-------------------------------------------------+
| demo | f6::ea:aa:8a:f9:bc::a0::::e1:f7::fa |
+------+-------------------------------------------------+
[root@armstrong ~(keystone_demo)]# export NET_ID=$(openstack network list | awk '/ private / { print $2 }')
[root@armstrong ~(keystone_demo)]# openstack stack create -t demo-template.yml --parameter "NetID=$NET_ID" stack
+---------------------+----------------------------------------------------------------------------------------------------------+
| Field | Value |
+---------------------+----------------------------------------------------------------------------------------------------------+
| id | a98a9958-088d---f7698884ce40 |
| stack_name | stack |
| description | Launch a basic instance with CirrOS image using the ``m1.tiny`` flavor, ``mykey`` key, and one network. |
| creation_time | --13T07::37Z |
| updated_time | None |
| stack_status | CREATE_IN_PROGRESS |
| stack_status_reason | Stack CREATE started |
+---------------------+----------------------------------------------------------------------------------------------------------+
[root@armstrong ~(keystone_demo)]# openstack stack list
+--------------------------------------+------------+--------------------+----------------------+--------------+
| ID | Stack Name | Stack Status | Creation Time | Updated Time |
+--------------------------------------+------------+--------------------+----------------------+--------------+
| a98a9958-088d---f7698884ce40 | stack | CREATE_IN_PROGRESS | --13T07::37Z | None |
+--------------------------------------+------------+--------------------+----------------------+--------------+
虚机启动后会变为COMPLETE
[root@armstrong ~(keystone_demo)]# openstack stack list
+--------------------------------------+------------+-----------------+----------------------+--------------+
| ID | Stack Name | Stack Status | Creation Time | Updated Time |
+--------------------------------------+------------+-----------------+----------------------+--------------+
| a98a9958-088d---f7698884ce40 | stack | CREATE_COMPLETE | --13T07::37Z | None |
+--------------------------------------+------------+-----------------+----------------------+--------------+ [root@armstrong ~(keystone_demo)]# openstack stack show stack
+-----------------------+---------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-----------------------+---------------------------------------------------------------------------------------------------------------------------+
| id | a98a9958-088d---f7698884ce40 |
| stack_name | stack |
| description | Launch a basic instance with CirrOS image using the ``m1.tiny`` flavor, ``mykey`` key, and one network. |
| creation_time | --13T07::37Z |
| updated_time | None |
| stack_status | CREATE_COMPLETE |
| stack_status_reason | Stack CREATE completed successfully |
| parameters | NetID: c53a005b-03af--b92e-2fd2acedcd1d |
| | OS::project_id: 5a55ee4fa9474c31a372e3dc8a951cf6 |
| | OS::stack_id: a98a9958-088d---f7698884ce40 |
| | OS::stack_name: stack |
| | |
| outputs | - description: Name of the instance. |
| | output_key: instance_name |
| | output_value: stack-server-m4qegurg52pm |
| | - description: IP address of the instance. |
| | output_key: instance_ip |
| | output_value: 10.0.0.8 |
| | |
| links | - href: http://192.168.122.209:8004/v1/5a55ee4fa9474c31a372e3dc8a951cf6/stacks/stack/a98a9958-088d-4882-8102-f7698884ce40 |
| | rel: self |
| | |
| parent | None |
| disable_rollback | True |
| deletion_time | None |
| stack_user_project_id | 932859b5db654e1bae13956d90b45a63 |
| capabilities | [] |
| notification_topics | [] |
| stack_owner | None |
| timeout_mins | None |
| tags | None |
+-----------------------+---------------------------------------------------------------------------------------------------------------------------+ 显示实例的名称和IP地址,并与OpenStack客户端的输出进行比较
[root@armstrong ~(keystone_demo)]# openstack stack output show --all stack
+---------------+-------------------------------------------------+
| Field | Value |
+---------------+-------------------------------------------------+
| instance_name | { |
| | "output_value": "stack-server-m4qegurg52pm", |
| | "output_key": "instance_name", |
| | "description": "Name of the instance." |
| | } |
| instance_ip | { |
| | "output_value": "10.0.0.8", |
| | "output_key": "instance_ip", |
| | "description": "IP address of the instance." |
| | } |
+---------------+-------------------------------------------------+ [root@armstrong ~(keystone_demo)]# openstack server list
+--------------------------------------+---------------------------+--------+------------------+-------------+---------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+---------------------------+--------+------------------+-------------+---------+
| f6879d35-7c12-4ddf-bb4a-c51f501a7328 | stack-server-m4qegurg52pm | ACTIVE | private=10.0.0.8 | cirros_test | m1.tiny |
+--------------------------------------+---------------------------+--------+------------------+-------------+---------+

heat launch an instance的更多相关文章

  1. 14. Launch an instance

    Controller Node: 1. source demo-openrc.sh 2. ssh-keygen 3. nova keypair-add --pub-key ~/.ssh/id_rsa. ...

  2. Launch an instance from a volume

    从image boot,并且attach一个no-bootable volume: $ nova boot --flavor --image -af91-43d8-b5e6-a4506aa8f369 ...

  3. 将 instance 部署到 OVS Local Network - 每天5分钟玩转 OpenStack(130)

    上一节创建了 OVS 本地网络 first_local_net,今天我们会部署一个 instance 到该网络并分析网络结构.launch 一个 instance,选择 first_local_net ...

  4. 将 instance 连接到 first_local_net - 每天5分钟玩转 OpenStack(82)

    上一节 first_local_net 已经就绪,下面创建 instance 并将其连接到该网络. 将 instance 连接到 first_local_net launch 一个 instance, ...

  5. openstack-lanch an instance and nova compute log analysis

    1. how to launch an instance: [root@localhost ~(keystone_admin)]# nova flavor-list+----+-----------+ ...

  6. 照着官网来安装openstack pike之创建并启动instance

    有了之前组件(keystone.glance.nova.neutron)的安装后,那么就可以在命令行创建并启动instance了 照着官网来安装openstack pike之environment设置 ...

  7. Launch Instance---source for openstack

    If you want to create an instance that uses ephemeral storage, meaning the instance data is lost whe ...

  8. multiple users to one ec2 instance setup

    http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/managing-users.html usually when use pem file as ...

  9. OpenStack 初探(一) -- All-In-One模式部署(初学OpenStack必备)

    OpenStack 初探(一) -- All-In-One模式部署(初学OpenStack必备) 一.操作前需了解:     1. OpenStack提供IaaS(基础设施即服务)服务,它是开源的云计 ...

随机推荐

  1. 2017.11.18 C语言的算法分析题目

    算法分析 1. 选定实验题目,仔细阅读实验要求,设计好输入输出,按照分治法的思想构思算法,选取合适的存储结构实现应用的操作. 2. 设计的结果应在Visual C++ 实验环境下实现并进行调试.(也可 ...

  2. lintcode 77.Longest Common Subsequence(最长公共子序列)、79. Longest Common Substring(最长公共子串)

    Longest Common Subsequence最长公共子序列: 每个dp位置表示的是第i.j个字母的最长公共子序列 class Solution { public: int findLength ...

  3. PEP8 常用规范

    PEP8 常用规范 完整的规范移步这里两个传送门 pep8规范 官方文档:https://www.python.org/dev/peps/pep-0008/ PEP8中文翻译:http://www.c ...

  4. 第二天了,由于博主太分心了,看看就跑去研究了一下ssh和ufw以及nmap,现在急需记录一下啦,哈哈!

    昨天看到了视频的ssh远程连接,因为我点电脑上装的是一个ubuntu的虚拟机,我根据视频看了一下,自己又试用了一下,我发现自己的ubuntu是能够远程到自己的Mac电脑上,一开始主要是因为自己不能连接 ...

  5. python与consul 实现gRPC服务注册-发现

    背景 通过对gRPC的介绍我们知道,当正常启动服务后,我们只需要知道ip,port就可以进行gRPC的连接.可以想到,这种方式并不适合用于线上环境,因为这样直连的话就失去了扩展性,当需要多机部署的时候 ...

  6. SpringBoot学习9:springboot整合thymeleaf

    1.创建maven项目,添加项目所需依赖 <!--springboot项目依赖的父项目--> <parent> <groupId>org.springframewo ...

  7. 如何把设计图自动转换为iOS代码? 在线等,挺急的!

    这是一篇可能略显枯燥的技术深度讨论与实践文章.如何把设计图自动转换为对应的iOS代码?作为一个 iOS开发爱好者,这是我很感兴趣的一个话题.最近也确实有了些许灵感,也确实取得了一点小成果,和大家分享一 ...

  8. Oracle口令文件管理

    Oracle的口令文件目录 $ORACLE_HOME/dbs/orapw$ORACLE_SID 建立口令文件 orapwd file=$ORACLE_HOME/dba/orapw$ORACLE_SID ...

  9. hdu_2837_Calculation(欧拉函数,快速幂求指数循环节)

    Assume that f(0) = 1 and 0^0=1. f(n) = (n%10)^f(n/10) for all n bigger than zero. Please calculate f ...

  10. centos 7 ifconfig 命令找不到

    最近在配置linux 环境: 在官网看到centOS除了最新版本7,那就尝试一下吧.最小安装centOS 7之后发现没有ifconfig命令,在网上找了一下都说是路径的路问题. 我用echo $PAT ...