在包含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. 广搜破解密码(HDU1195)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1195 解题报告: #include<iostream> #include<cstdi ...

  2. linux命令之awk命令

    awk是一种编程语言,用于在linux/unix下对文本和数据进行处理.数据可以来自标准输入(stdin).一个或多个文件,或其它命令的输出.它支持用户自定义函数和动态正则表达式等先进功能,是linu ...

  3. CentOS 5.6怎么安装MongoDB数据库?

    1. 下载Linux版本的 MongoDB 数据库 到官方的下载页面下载mongodb的Linux版本,32位还是64位根据自己的情况自行选择 http://www.mongodb.org/downl ...

  4. 20145238-荆玉茗 《Java程序设计》第二周学习总结

    20145238 <Java程序设计>第2周学习总结 教材学习内容总结 关于一些格式方面的问题: 1.关键字:在定义java文件名的时候要避免这些关键字的出现,因为他们在java程序语言中 ...

  5. Spring Security 之Session管理配置

    废话不多说,直接上代码.示例如下: 1.   新建Maven项目  session 2.   pom.xml <project xmlns="http://maven.apache.o ...

  6. open cv & vs

    原来基于vs和msdn一起读视频,结果发现现在的函数不能用了.找不到合适的解码器了,只好转战opencv. 具体怎么用,网上查吧,不过opencv读视频的例子,可以见这个. http://blog.c ...

  7. Java面试不得不知的问题(一)

    程序员面试   1. 面向对象的特征有哪些方面  ·   抽象:抽象就是忽略一个主题中与当前目标无关的那些方面,以便更充分地注意与当前目标有关的方面.抽象并不打算了解全部问题,而只是选择其中的一部分, ...

  8. 如何使用MongoDB+Springboot实现分布式ID?

    转载请标明出处: http://blog.csdn.net/forezp/article/details/69056017 本文出自方志朋的博客 一.背景 如何实现分布式id,搜索相关的资料,一般会给 ...

  9. 小程序navigateTo和redirectTo的使用

    最近公司商城项目,有个小问题,就是在商品详情页>购物车页>确认下单页>支付成功和取消支付都会前往订单详情页.当时我没想这么多就全部跳转都用了navigateTo,这样做的话,第一个问 ...

  10. 通过tomcat配置访问本机资源

    背景:在最近的项目中使用海康威视的摄像机,在项目预算中没有购买对应的硬盘录像机,但是由于客户需要能够进行视频的回放功能,所以直接采用了海康提供的视频管理客户端直接进行视频录像,然后保存在本机进行播放. ...