在包含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. 【洛谷P1379】八数码难题(广搜、A*)

    八数码难题 题目描述 一.广搜: 首先要考虑用什么存每一个状态 显然每个状态都用一个矩阵存是很麻烦的. 我们可以考虑将一个3*3的矩阵用一个字符串或long long 存. 每次扩展时再转化为矩阵. ...

  2. gulp详细教程——前端自动化构建工具

    项目构建 一个项目是由多个开发者共同开发一个项目,各负责不同的模块,这就会造成一个完整的项目许多‘代码片段’组成,合并css.javascript,压缩html.css.javascript.imag ...

  3. TSMessages,非HUD风格的iOS提示框(附官方demo BUG修复方案)

    优势 先看效果 个人觉得这种提示效果用在UITableView上要比HUD优雅美观,而其他情况下的提示,用HUD比较好 源码简介易懂,用起来也很方便 导入 pod导入相对很简单,主要讲怎么手动导入这个 ...

  4. Android学习<2>

    Android自学资料汇总 资料参考地址: http://blog.csdn.net/guolin_blog/article/details/26365913 http://drakeet.me/an ...

  5. v-show

    v-show的原理是当值为false的时候,元素display:none  隐藏了元素且脱离文档流,但是在dom 中仍然存在. 与v-if使用场景不同,文档中提到,当需要高频切换的时候使用v-show ...

  6. MySQL - Linux下安装

    本安装方式仅对5.7.21版本负责. 下载地址:wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21-linux-glibc2 ...

  7. 描述linux目录结构以及目录结构命名规定

    FHS全称(Filesystem Hierarchy Standard),中文意思是目录层次标准,是linux的目录规范标准. 详情点击查看 FHS定义了两层规范: 第一层:“/”目录下的各个目录应该 ...

  8. 2.1 <script>元素【JavaScript高级程序设计第三版】

    向 HTML 页面中插入 JavaScript 的主要方法,就是使用<script>元素.这个元素由 Netscape 创造并在 Netscape Navigator 2 中首先实现.后来 ...

  9. php 文件操作和文件上传

    文件操作 http://www.w3school.com.cn/php/php_file.asp http://www.w3school.com.cn/php/php_file_open.asp ht ...

  10. [USACO5.1]夜空繁星Starry Night

    题目背景 高高的星空,簇簇闪耀的群星形态万千.一个星座(cluster)是一群连通的星组成的非空连通星系,这里的连通是指水平,垂直或者对角相邻的两个星星.一个星座不能是另一个更大星座的一部分, 星座可 ...