• 基本heat脚本截图:

  • 成heat脚本结果截图:

 

 实验步骤

[root@xiandian ~]# #使用编配服务实现自动部署云主机vm
[root@xiandian ~]# #第一步 获取基础资源 包括认证,镜像,网络,计算和存储(块存和对象存储)等,设置 密钥对,安全组策略
[root@xiandian ~]# #1.获取,设置认证服务
[root@xiandian ~]# #创建和设置用户user 租户project 角色role
[root@xiandian ~]# #创建名为cookbook的项目组,做研发部门
[root@xiandian ~]# openstack project create cookbook --domain xiandian --description 研发部门
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | 研发部门                         |
| domain_id   | 3ac89594c8e944a9b5bb567fca4e75aa |
| enabled     | True                             |
| id          | 2130d9a1afd7494bac957e32a7bbafd0 |
| is_domain   | False                            |
| name        | cookbook                         |
| parent_id   | 3ac89594c8e944a9b5bb567fca4e75aa |
+-------------+----------------------------------+
[root@xiandian ~]# openstack project list
+----------------------------------+----------+
| ID                               | Name     |
+----------------------------------+----------+
| 0ab2dbde4f754b699e22461426cd0774 | admin    |
| 20b1ab08ea644670addb52f6d2f2ed61 | service  |
| 2130d9a1afd7494bac957e32a7bbafd0 | cookbook |
| f35885323bac4e4987065a4ca2d364f6 | demo     |
+----------------------------------+----------+
[root@xiandian ~]# #创建角色manager
[root@xiandian ~]# openstack role create manager
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | None                             |
| id        | c3b1801178c4446b8b382bffa554ad3a |                                                   | name      | manager                          |                                                                            +-----------+----------------------------------+
[root@xiandian ~]# openstack role list
+----------------------------------+------------------+
| ID                               | Name             |
+----------------------------------+------------------+
| 384c446de0dc4c80bc4ef187c555dacd | user             |
| 5adf91f71f7646cb89917e2f975aa68d | heat_stack_owner |
| 710e4f3907264eb3b65e97e27990f30b | admin            |
| 8229ef312d194bbda9aceefa4b8362cd | heat_stack_user  |
| c3b1801178c4446b8b382bffa554ad3a | manager          |
| c83aed0bc3784e4abe7dbf1f095b51e4 | ResellerAdmin    |
+----------------------------------+------------------+
[root@xiandian ~]# #创建用户cook30
[root@xiandian ~]# openstack user create cook30 --password 000000 --domain xiandian --email cook30@xiandian.com
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | 3ac89594c8e944a9b5bb567fca4e75aa |
| email     | cook30@xiandian.com              |
| enabled   | True                             |
| id        | 92b05cff1426483bb6a0bf1f919f4b7f |
| name      | cook30                           |
+-----------+----------------------------------+
[root@xiandian ~]# #绑定项目,用户及角色
[root@xiandian ~]# openstack role add manager --user cook30 --project cookbook
[root@xiandian ~]# openstack role list --user cook50 --project cookbook
No user with a name or ID of 'cook50' exists.
[root@xiandian ~]# openstack role list --user cook30 --project cookbook
+----------------------------------+---------+----------+--------+
| ID                               | Name    | Project  | User   |
+----------------------------------+---------+----------+--------+
| c3b1801178c4446b8b382bffa554ad3a | manager | cookbook | cook30 |
+----------------------------------+---------+----------+--------+
[root@xiandian ~]# #2.获取镜像资源
[root@xiandian ~]# 获取源文件 制作镜像 设置镜像属性
-bash: $'\350\216\267\345\217\226\346\272\220\346\226\207\344\273\266': command not found
[root@xiandian ~]# #获取源文件 制作镜像 设置镜像属性
[root@xiandian ~]# #获取源文件
[root@xiandian ~]# wget ftp://172.16.102.20/cirros-0.3.4-x86_64-disk.img
--2021-12-20 09:22:16--  ftp://172.16.102.20/cirros-0.3.4-x86_64-disk.img
           => ‘cirros-0.3.4-x86_64-disk.img’
Connecting to 172.16.102.20:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD not needed.
==> SIZE cirros-0.3.4-x86_64-disk.img ... 13287936
==> PASV ... done.    ==> RETR cirros-0.3.4-x86_64-disk.img ... done.
Length: 13287936 (13M) (unauthoritative)

100%[=========================================================>] 13,287,936  --.-K/s   in 0.1s    

2021-12-20 09:22:16 (102 MB/s) - ‘cirros-0.3.4-x86_64-disk.img’ saved [13287936]

[root@xiandian ~]# #查看源文件信息
[root@xiandian ~]# file cirros-0.3.4-x86_64-disk.img 
cirros-0.3.4-x86_64-disk.img: QEMU QCOW Image (v2), 41126400 bytes
[root@xiandian ~]# #使用源文件创建镜像
[root@xiandian ~]# glance image-create --name cirros30 --disk-format qcow2 --container-format bare --progress<cirros-0.3.4-x86_64-disk.img 
[=============================>] 100%
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | ee1eca47dc88f4879d8a229cc70a07c6     |
| container_format | bare                                 |
| created_at       | 2021-12-20T09:25:41Z                 |
| disk_format      | qcow2                                |
| id               | dfe43474-6f7b-4189-b907-720c0b30cdee |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | cirros30                             |
| owner            | 0ab2dbde4f754b699e22461426cd0774     |
| protected        | False                                |
| size             | 13287936                             |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2021-12-20T09:25:41Z                 |
| virtual_size     | None                                 |
| visibility       | private                              |
+------------------+--------------------------------------+
[root@xiandian ~]# #使用同一个源文件来创建不同的镜像
[root@xiandian ~]# glance image-create --name cirros130 --disk-format vmdk --container-format bare --progress<cirros-0.3.4-x86_64-disk.img 
[=============================>] 100%
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | ee1eca47dc88f4879d8a229cc70a07c6     |
| container_format | bare                                 |
| created_at       | 2021-12-20T09:27:17Z                 |
| disk_format      | vmdk                                 |
| id               | 2ee64c4f-f7ef-4102-92e5-2862e5c5aaaf |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | cirros130                            |
| owner            | 0ab2dbde4f754b699e22461426cd0774     |
| protected        | False                                |
| size             | 13287936                             |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2021-12-20T09:27:17Z                 |
| virtual_size     | None                                 |
| visibility       | private                              |
+------------------+--------------------------------------+
[root@xiandian ~]# #删除镜像glance image-delete
[root@xiandian ~]# #修改镜像的属性
[root@xiandian ~]# glance image-update --min-disk=20 --min-ram=1024 dfe43474-6f7b-4189-b907-720c0b30cdee
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | ee1eca47dc88f4879d8a229cc70a07c6     |
| container_format | bare                                 |
| created_at       | 2021-12-20T09:25:41Z                 |
| disk_format      | qcow2                                |
| id               | dfe43474-6f7b-4189-b907-720c0b30cdee |
| min_disk         | 20                                   |
| min_ram          | 1024                                 |
| name             | cirros30                             |
| owner            | 0ab2dbde4f754b699e22461426cd0774     |
| protected        | False                                |
| size             | 13287936                             |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2021-12-20T09:29:57Z                 |
| virtual_size     | None                                 |
| visibility       | private                              |
+------------------+--------------------------------------+
[root@xiandian ~]# #3.获取网络资源:创建子网
[root@xiandian ~]# #查看当前可用网络
[root@xiandian ~]# neutron net-lsit
Unknown command [u'net-lsit']
[root@xiandian ~]# neutron net-list
+--------------------------------------+------------+---------+
| id                                   | name       | subnets |
+--------------------------------------+------------+---------+
| bd923693-d9b1-4094-bd5b-22a038c44827 | sharednet1 |         |
+--------------------------------------+------------+---------+
[root@xiandian ~]# #在当前可用网络下创建子网
[root@xiandian ~]# neutron subnet-create sharednet1 --name subnet30 --allocation-pool start=192.168.30.2,end=192.168.30.127 --gateway 192.168.30.1 192.168.30.0/24
Created a new subnet:
+-------------------+----------------------------------------------------+
| Field             | Value                                              |
+-------------------+----------------------------------------------------+
| allocation_pools  | {"start": "192.168.30.2", "end": "192.168.30.127"} |
| cidr              | 192.168.30.0/24                                    |
| created_at        | 2021-12-20T09:36:08                                |
| description       |                                                    |
| dns_nameservers   |                                                    |
| enable_dhcp       | True                                               |
| gateway_ip        | 192.168.30.1                                       |
| host_routes       |                                                    |
| id                | 7a3070ca-3cb6-4a34-9900-0d615ef68484               |
| ip_version        | 4                                                  |
| ipv6_address_mode |                                                    |
| ipv6_ra_mode      |                                                    |
| name              | subnet30                                           |
| network_id        | bd923693-d9b1-4094-bd5b-22a038c44827               |
| subnetpool_id     |                                                    |
| tenant_id         | 0ab2dbde4f754b699e22461426cd0774                   |
| updated_at        | 2021-12-20T09:36:08                                |
+-------------------+----------------------------------------------------+
[root@xiandian ~]# neutron subnet-list
+---------------------------------+----------+-----------------+----------------------------------+
| id                              | name     | cidr            | allocation_pools                 |
+---------------------------------+----------+-----------------+----------------------------------+
| 7a3070ca-                       | subnet30 | 192.168.30.0/24 | {"start": "192.168.30.2", "end": |
| 3cb6-4a34-9900-0d615ef68484     |          |                 | "192.168.30.127"}                |
+---------------------------------+----------+-----------------+----------------------------------+
[root@xiandian ~]# #创建网络neutron net-create 删除子网 neutron subnet-delete
[root@xiandian ~]# #5.获取计算资源 设置主机类型 生产密钥对 设置安全策略
[root@xiandian ~]# #查看,创建主机类型flavor
[root@xiandian ~]# #nova flavor-list
[root@xiandian ~]# nova flavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1  | m1.tiny   | 512       | 1    | 0         |      | 1     | 1.0         | True      |
| 2  | m1.small  | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
| 3  | m1.medium | 4096      | 40   | 0         |      | 2     | 1.0         | True      |
| 4  | m1.large  | 8192      | 80   | 0         |      | 4     | 1.0         | True      |
| 5  | m1.xlarge | 16384     | 160  | 0         |      | 8     | 1.0         | True      |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
[root@xiandian ~]# #自定义主机类型
[root@xiandian ~]# nova flavor-create xu.small 6 4096 60 2
+----+----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name     | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+----------+-----------+------+-----------+------+-------+-------------+-----------+
| 6  | xu.small | 4096      | 60   | 0         |      | 2     | 1.0         | True      |
+----+----------+-----------+------+-----------+------+-------+-------------+-----------+
[root@xiandian ~]# nova flavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1  | m1.tiny   | 512       | 1    | 0         |      | 1     | 1.0         | True      |
| 2  | m1.small  | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
| 3  | m1.medium | 4096      | 40   | 0         |      | 2     | 1.0         | True      |
| 4  | m1.large  | 8192      | 80   | 0         |      | 4     | 1.0         | True      |
| 5  | m1.xlarge | 16384     | 160  | 0         |      | 8     | 1.0         | True      |
| 6  | xu.small  | 4096      | 60   | 0         |      | 2     | 1.0         | True      |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
[root@xiandian ~]# #创建安全组,添加规则
[root@xiandian ~]# nova secgroup-list
+--------------------------------------+---------+------------------------+
| Id                                   | Name    | Description            |
+--------------------------------------+---------+------------------------+
| 7f1ddb60-54d0-495b-bf84-3f7f022d9f2c | default | Default security group |
+--------------------------------------+---------+------------------------+
[root@xiandian ~]# nova secgroup-create cookbook_rules 'create a secgroup'
+--------------------------------------+----------------+-------------------+
| Id                                   | Name           | Description       |
+--------------------------------------+----------------+-------------------+
| 20d81dc2-c740-4fed-95cb-92e9a63d1923 | cookbook_rules | create a secgroup |
+--------------------------------------+----------------+-------------------+
[root@xiandian ~]# nova secgroup-list
+--------------------------------------+----------------+------------------------+
| Id                                   | Name           | Description            |
+--------------------------------------+----------------+------------------------+
| 20d81dc2-c740-4fed-95cb-92e9a63d1923 | cookbook_rules | create a secgroup      |
| 7f1ddb60-54d0-495b-bf84-3f7f022d9f2c | default        | Default security group |
+--------------------------------------+----------------+------------------------+
[root@xiandian ~]# nova secgroup-add-rule cookbook_rules TCP 1 65535 192.168.30.0/24
+-------------+-----------+---------+-----------------+--------------+
| IP Protocol | From Port | To Port | IP Range        | Source Group |
+-------------+-----------+---------+-----------------+--------------+
| tcp         | 1         | 65535   | 192.168.30.0/24 |              |
+-------------+-----------+---------+-----------------+--------------+
[root@xiandian ~]# nova secgroup-add-rule cookbook_rules ICMP -1 -1 0.0.0.0/0
+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range  | Source Group |
+-------------+-----------+---------+-----------+--------------+
| icmp        | -1        | -1      | 0.0.0.0/0 |              |
+-------------+-----------+---------+-----------+--------------+
[root@xiandian ~]# nova secgroup-list-rules cookbook_rules
+-------------+-----------+---------+-----------------+--------------+
| IP Protocol | From Port | To Port | IP Range        | Source Group |
+-------------+-----------+---------+-----------------+--------------+
| tcp         | 1         | 65535   | 192.168.30.0/24 |              |
| icmp        | -1        | -1      | 0.0.0.0/0       |              |
+-------------+-----------+---------+-----------------+--------------+
[root@xiandian ~]# #创建密钥对
[root@xiandian ~]# nova keypair-list
+------+------+-------------+
| Name | Type | Fingerprint |
+------+------+-------------+
+------+------+-------------+
[root@xiandian ~]# nova keypair-add mykey > mykey
^[[A^[[A[root@xiandnova keypair-list
+-------+------+-------------------------------------------------+
| Name  | Type | Fingerprint                                     |
+-------+------+-------------------------------------------------+
| mykey | ssh  | 34:99:8a:5e:9c:26:c8:78:62:06:22:8d:f6:b0:63:ee |
+-------+------+-------------------------------------------------+
[root@xiandian ~]# #5.获取存储资源cinder\swift
[root@xiandian ~]# #第二步:编写编配脚本test30.yml
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# heat resource-type-list
+----------------------------------------------------+
| resource_type                                      |
+----------------------------------------------------+
| AWS::AutoScaling::AutoScalingGroup                 |
| AWS::AutoScaling::LaunchConfiguration              |
| AWS::AutoScaling::ScalingPolicy                    |
| AWS::CloudFormation::Stack                         |
| AWS::CloudFormation::WaitCondition                 |
| AWS::CloudFormation::WaitConditionHandle           |
| AWS::CloudWatch::Alarm                             |
| AWS::EC2::EIP                                      |
| AWS::EC2::EIPAssociation                           |
| AWS::EC2::Instance                                 |
| AWS::EC2::InternetGateway                          |
| AWS::EC2::NetworkInterface                         |
| AWS::EC2::RouteTable                               |
| AWS::EC2::SecurityGroup                            |
| AWS::EC2::Subnet                                   |
| AWS::EC2::SubnetRouteTableAssociation              |
| AWS::EC2::VPC                                      |
| AWS::EC2::VPCGatewayAttachment                     |
| AWS::EC2::Volume                                   |
| AWS::EC2::VolumeAttachment                         |
| AWS::ElasticLoadBalancing::LoadBalancer            |
| AWS::IAM::AccessKey                                |
| AWS::IAM::User                                     |
| AWS::RDS::DBInstance                               |
| AWS::S3::Bucket                                    |
| OS::Ceilometer::Alarm                              |
| OS::Ceilometer::CombinationAlarm                   |
| OS::Ceilometer::GnocchiAggregationByMetricsAlarm   |
| OS::Ceilometer::GnocchiAggregationByResourcesAlarm |
| OS::Ceilometer::GnocchiResourcesAlarm              |
| OS::Cinder::EncryptedVolumeType                    |
| OS::Cinder::Volume                                 |
| OS::Cinder::VolumeAttachment                       |
| OS::Cinder::VolumeType                             |
| OS::Glance::Image                                  |
| OS::Heat::AccessPolicy                             |
| OS::Heat::AutoScalingGroup                         |
| OS::Heat::CloudConfig                              |
| OS::Heat::HARestarter                              |
| OS::Heat::InstanceGroup                            |
| OS::Heat::MultipartMime                            |
| OS::Heat::None                                     |
| OS::Heat::RandomString                             |
| OS::Heat::ResourceChain                            |
| OS::Heat::ResourceGroup                            |
| OS::Heat::ScalingPolicy                            |
| OS::Heat::SoftwareComponent                        |
| OS::Heat::SoftwareConfig                           |
| OS::Heat::SoftwareDeployment                       |
| OS::Heat::SoftwareDeploymentGroup                  |
| OS::Heat::SoftwareDeployments                      |
| OS::Heat::Stack                                    |
| OS::Heat::StructuredConfig                         |
| OS::Heat::StructuredDeployment                     |
| OS::Heat::StructuredDeploymentGroup                |
| OS::Heat::StructuredDeployments                    |
| OS::Heat::SwiftSignal                              |
| OS::Heat::SwiftSignalHandle                        |
| OS::Heat::TestResource                             |
| OS::Heat::UpdateWaitConditionHandle                |
| OS::Heat::WaitCondition                            |
| OS::Heat::WaitConditionHandle                      |
| OS::Keystone::Endpoint                             |
| OS::Keystone::Group                                |
| OS::Keystone::GroupRoleAssignment                  |
| OS::Keystone::Project                              |
| OS::Keystone::Region                               |
| OS::Keystone::Role                                 |
| OS::Keystone::Service                              |
| OS::Keystone::User                                 |
| OS::Keystone::UserRoleAssignment                   |
| OS::Neutron::AddressScope                          |
| OS::Neutron::ExtraRoute                            |
| OS::Neutron::FloatingIP                            |
| OS::Neutron::FloatingIPAssociation                 |
| OS::Neutron::MeteringLabel                         |
| OS::Neutron::MeteringRule                          |
| OS::Neutron::Net                                   |
| OS::Neutron::NetworkGateway                        |
| OS::Neutron::Port                                  |
| OS::Neutron::ProviderNet                           |
| OS::Neutron::RBACPolicy                            |
| OS::Neutron::Router                                |
| OS::Neutron::RouterInterface                       |
| OS::Neutron::SecurityGroup                         |
| OS::Neutron::Subnet                                |
| OS::Neutron::SubnetPool                            |
| OS::Nova::Flavor                                   |
| OS::Nova::FloatingIP                               |
| OS::Nova::FloatingIPAssociation                    |
| OS::Nova::HostAggregate                            |
| OS::Nova::KeyPair                                  |
| OS::Nova::Server                                   |
| OS::Nova::ServerGroup                              |
| OS::Swift::Container                               |
+----------------------------------------------------+
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# chmod +X test30.yml 
[root@xiandian ~]# #第三部:使用编配文件启动栈资源,启动实例
[root@xiandian ~]# heat stack-create test30 -f test30.yml
ERROR: Property error: : resources.server30.properties.networks[0].network: : Error validating value 'subnet30': Unable to find network with name or id 'subnet30'
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# neutron net-lsit                                                                                           Unknown command [u'net-lsit']
[root@xiandian ~]# neutron net-list                                                                                           +--------------------------------------+------------+------------------------------------------------------+
| id                                   | name       | subnets                                              |
+--------------------------------------+------------+------------------------------------------------------+
| bd923693-d9b1-4094-bd5b-22a038c44827 | sharednet1 | 7a3070ca-3cb6-4a34-9900-0d615ef68484 192.168.30.0/24 |
+--------------------------------------+------------+------------------------------------------------------+
[root@xiandian ~]# neutron subnet-list                                                                                        +--------------------------------------+----------+-----------------+----------------------------------------------------+
| id                                   | name     | cidr            | allocation_pools                                   |
+--------------------------------------+----------+-----------------+----------------------------------------------------+
| 7a3070ca-3cb6-4a34-9900-0d615ef68484 | subnet30 | 192.168.30.0/24 | {"start": "192.168.30.2", "end": "192.168.30.127"} |
+--------------------------------------+----------+-----------------+----------------------------------------------------+
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# heat stack-create test30 -f test30.yml
+--------------------------------------+------------+--------------------+---------------------+--------------+
| id                                   | stack_name | stack_status       | creation_time       | updated_time |
+--------------------------------------+------------+--------------------+---------------------+--------------+
| f256dfa3-59da-46fe-9200-5bcd2a274407 | test30     | CREATE_IN_PROGRESS | 2021-12-20T10:30:40 | None         |
+--------------------------------------+------------+--------------------+---------------------+--------------+
[root@xiandian ~]# nova list
+--------------------------------------+-------------+--------+------------+-------------+----------+
| ID                                   | Name        | Status | Task State | Power State | Networks |
+--------------------------------------+-------------+--------+------------+-------------+----------+
| 05f10d79-2a9e-4470-9a23-8794f0ff8a70 | myinstance1 | ERROR  | -          | NOSTATE     |          |
+--------------------------------------+-------------+--------+------------+-------------+----------+
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# nova list
+--------------------------------------+-------------+--------+------------+-------------+----------+
| ID                                   | Name        | Status | Task State | Power State | Networks |
+--------------------------------------+-------------+--------+------------+-------------+----------+
| 05f10d79-2a9e-4470-9a23-8794f0ff8a70 | myinstance1 | ERROR  | -          | NOSTATE     |          |
+--------------------------------------+-------------+--------+------------+-------------+----------+
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# heat stack-create test130 -f test30.yml
ERROR: The template section is invalid: server130
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# heat stack-delete test30
Are you sure you want to delete this stack(s) [y/N]? y
+--------------------------------------+------------+---------------+---------------------+--------------+
| id                                   | stack_name | stack_status  | creation_time       | updated_time |
+--------------------------------------+------------+---------------+---------------------+--------------+
| f256dfa3-59da-46fe-9200-5bcd2a274407 | test30     | CREATE_FAILED | 2021-12-20T10:30:40 | None         |
+--------------------------------------+------------+---------------+---------------------+--------------+
[root@xiandian ~]# heat stack-create test130 -f test30.yml
ERROR: The template section is invalid: server130
[root@xiandian ~]# heat stack-create test30 -f test30.yml
ERROR: The template section is invalid: server130
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# heat stack-create test130 -f test30.yml
ERROR: The template section is invalid: server130
[root@xiandian ~]# heat stack-delete test130
Are you sure you want to delete this stack(s) [y/N]? y
ERROR: The Stack (test130) could not be found.
Unable to delete 1 of the 1 stacks.
[root@xiandian ~]# heat stack-create test30 -f test30.yml
ERROR: The template section is invalid: server130
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# heat stack-create test30 -f test30.yml
+--------------------------------------+------------+--------------------+---------------------+--------------+
| id                                   | stack_name | stack_status       | creation_time       | updated_time |
+--------------------------------------+------------+--------------------+---------------------+--------------+
| bfd40879-d960-445e-a0cc-be7a8f9b53aa | test30     | CREATE_IN_PROGRESS | 2021-12-20T11:01:58 | None         |
+--------------------------------------+------------+--------------------+---------------------+--------------+
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# heat stack-delete test30
Are you sure you want to delete this stack(s) [y/N]? y
+--------------------------------------+------------+--------------------+---------------------+--------------+
| id                                   | stack_name | stack_status       | creation_time       | updated_time |
+--------------------------------------+------------+--------------------+---------------------+--------------+
| bfd40879-d960-445e-a0cc-be7a8f9b53aa | test30     | DELETE_IN_PROGRESS | 2021-12-20T11:01:58 | None         |
+--------------------------------------+------------+--------------------+---------------------+--------------+
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# chmod +X test30.yml 
[root@xiandian ~]# heat stack-create test30 -f test30.yml
ERROR: The template section is invalid: server130
[root@xiandian ~]# heat stack-create test130 -f test30.yml
ERROR: The template section is invalid: server130
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# heat stack-create test130 -f test30.yml
+--------------------------------------+------------+--------------------+---------------------+--------------+
| id                                   | stack_name | stack_status       | creation_time       | updated_time |
+--------------------------------------+------------+--------------------+---------------------+--------------+
| 3427d922-f863-4433-8f46-f550de53ec53 | test130    | CREATE_IN_PROGRESS | 2021-12-20T11:08:28 | None         |
+--------------------------------------+------------+--------------------+---------------------+--------------+
[root@xiandian ~]# nova list
+--------------------------------------+-------------+--------+------------+-------------+-----------------------------------------+
| ID                                   | Name        | Status | Task State | Power State | Networks                                |
+--------------------------------------+-------------+--------+------------+-------------+-----------------------------------------+
| a33484e4-c4b3-4684-b761-195006125847 | myinstance1 | BUILD  | -          | NOSTATE     | sharednet1=192.168.30.29, 192.168.30.31 |
| 84016019-3dad-4627-9dba-b61caa6dfe2a | myinstance2 | BUILD  | spawning   | NOSTATE     | sharednet1=192.168.30.30, 192.168.30.32 |
+--------------------------------------+-------------+--------+------------+-------------+-----------------------------------------+
[root@xiandian ~]# nova list
+--------------------------------------+-------------+--------+------------+-------------+--------------------------+
| ID                                   | Name        | Status | Task State | Power State | Networks                 |
+--------------------------------------+-------------+--------+------------+-------------+--------------------------+
| 9091c8a8-2c99-4358-ac9c-4030d28ec2ba | myinstance1 | BUILD  | spawning   | NOSTATE     | sharednet1=192.168.30.35 |
| 2cea806d-4273-4838-b301-1d41d1bbcfa4 | myinstance2 | BUILD  | -          | NOSTATE     |                          |
+--------------------------------------+-------------+--------+------------+-------------+--------------------------+
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# nova list
+--------------------------------------+-------------+--------+------------+-------------+--------------------------------------------------------+
| ID                                   | Name        | Status | Task State | Power State | Networks                                               |
+--------------------------------------+-------------+--------+------------+-------------+--------------------------------------------------------+
| 31ec80cc-b60b-41fd-8e52-c2ace957c0a6 | myinstance1 | BUILD  | spawning   | NOSTATE     | sharednet1=192.168.30.59, 192.168.30.61, 192.168.30.63 |
| f14760c7-23ed-4ad7-998a-66bd8771d952 | myinstance2 | BUILD  | scheduling | NOSTATE     | sharednet1=192.168.30.60, 192.168.30.62                |
+--------------------------------------+-------------+--------+------------+-------------+--------------------------------------------------------+
[root@xiandian ~]# nova list
+--------------------------------------+-------------+--------+------------+-------------+----------+
| ID                                   | Name        | Status | Task State | Power State | Networks |
+--------------------------------------+-------------+--------+------------+-------------+----------+
| 31ec80cc-b60b-41fd-8e52-c2ace957c0a6 | myinstance1 | ERROR  | -          | NOSTATE     |          |
| f14760c7-23ed-4ad7-998a-66bd8771d952 | myinstance2 | ERROR  | -          | NOSTATE     |          |
+--------------------------------------+-------------+--------+------------+-------------+----------+
[root@xiandian ~]# heat stack-delete test30
Are you sure you want to delete this stack(s) [y/N]? y
ERROR: The Stack (test30) could not be found.
Unable to delete 1 of the 1 stacks.
[root@xiandian ~]# heat stack-create test130 -f test30.yml --parameters "Name=instance"
ERROR: The Stack (test130) already exists.
[root@xiandian ~]# heat stack-delete test130
Are you sure you want to delete this stack(s) [y/N]? y
+--------------------------------------+------------+---------------+---------------------+--------------+
| id                                   | stack_name | stack_status  | creation_time       | updated_time |
+--------------------------------------+------------+---------------+---------------------+--------------+
| 3427d922-f863-4433-8f46-f550de53ec53 | test130    | CREATE_FAILED | 2021-12-20T11:08:28 | None         |
+--------------------------------------+------------+---------------+---------------------+--------------+
[root@xiandian ~]# heat stack-create test130 -f test30.yml --parameters "Name=instance"
+--------------------------------------+------------+--------------------+---------------------+--------------+
| id                                   | stack_name | stack_status       | creation_time       | updated_time |
+--------------------------------------+------------+--------------------+---------------------+--------------+
| 6cd5af90-776e-44d2-91e3-3f4e9ba37a9c | test130    | CREATE_IN_PROGRESS | 2021-12-20T11:14:54 | None         |
+--------------------------------------+------------+--------------------+---------------------+--------------+
[root@xiandian ~]# nova list
+--------------------------------------+-------------+--------+------------+-------------+-----------------------------------------+
| ID                                   | Name        | Status | Task State | Power State | Networks                                |
+--------------------------------------+-------------+--------+------------+-------------+-----------------------------------------+
| 521f894e-9a5c-43ef-8fd0-6601e0a9e5af | instance    | BUILD  | spawning   | NOSTATE     | sharednet1=192.168.30.65, 192.168.30.67 |
| cd9a4a00-3f75-42d0-8d7a-f609322a6571 | myinstance2 | BUILD  | spawning   | NOSTATE     | sharednet1=192.168.30.66                |
+--------------------------------------+-------------+--------+------------+-------------+-----------------------------------------+
[root@xiandian ~]# nova list
+--------------------------------------+-------------+--------+------------+-------------+----------+
| ID                                   | Name        | Status | Task State | Power State | Networks |
+--------------------------------------+-------------+--------+------------+-------------+----------+
| cd9a4a00-3f75-42d0-8d7a-f609322a6571 | myinstance2 | ERROR  | -          | NOSTATE     |          |
+--------------------------------------+-------------+--------+------------+-------------+----------+
[root@xiandian ~]# nova list
+--------------------------------------+-------------+--------+------------+-------------+--------------------------+
| ID                                   | Name        | Status | Task State | Power State | Networks                 |
+--------------------------------------+-------------+--------+------------+-------------+--------------------------+
| 29a124e6-f199-4c01-b4af-37b30df9e7ed | instance    | BUILD  | -          | NOSTATE     | sharednet1=192.168.30.71 |
| 2e050e09-e33c-4f99-817a-57a48030bdde | myinstance2 | BUILD  | spawning   | NOSTATE     | sharednet1=192.168.30.72 |
+--------------------------------------+-------------+--------+------------+-------------+--------------------------+
[root@xiandian ~]# nova list
+--------------------------------------+-------------+--------+------------+-------------+-----------------------------------------+
| ID                                   | Name        | Status | Task State | Power State | Networks                                |
+--------------------------------------+-------------+--------+------------+-------------+-----------------------------------------+
| 77c7b36e-c05c-410e-a1d0-dfd79b11e86a | instance    | BUILD  | spawning   | NOSTATE     | sharednet1=192.168.30.77, 192.168.30.79 |
| d18ee61e-9a22-4027-b2e3-4d1347bf0474 | myinstance2 | BUILD  | networking | NOSTATE     | sharednet1=192.168.30.78                |
+--------------------------------------+-------------+--------+------------+-------------+-----------------------------------------+
[root@xiandian ~]# nova list
+--------------------------------------+-------------+--------+------------+-------------+--------------------------------------------------------+
| ID                                   | Name        | Status | Task State | Power State | Networks                                               |
+--------------------------------------+-------------+--------+------------+-------------+--------------------------------------------------------+
| 77c7b36e-c05c-410e-a1d0-dfd79b11e86a | instance    | BUILD  | spawning   | NOSTATE     | sharednet1=192.168.30.77, 192.168.30.79, 192.168.30.81 |
| d18ee61e-9a22-4027-b2e3-4d1347bf0474 | myinstance2 | BUILD  | spawning   | NOSTATE     | sharednet1=192.168.30.78, 192.168.30.80                |
+--------------------------------------+-------------+--------+------------+-------------+--------------------------------------------------------+
[root@xiandian ~]# vi test30.yml
[root@xiandian ~]# nova list
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+
[root@xiandian ~]# nova list
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+
[root@xiandian ~]# nova list
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+
[root@xiandian ~]# nova list
+--------------------------------------+-------------+--------+------------+-------------+-----------------------------------------+
| ID                                   | Name        | Status | Task State | Power State | Networks                                |
+--------------------------------------+-------------+--------+------------+-------------+-----------------------------------------+
| 60ef673e-06b9-44d4-a019-5a68225dbdc3 | instance    | BUILD  | -          | NOSTATE     | sharednet1=192.168.30.90                |
| aea3bea8-323e-4a22-accd-1b08b9619a9c | myinstance2 | BUILD  | spawning   | NOSTATE     | sharednet1=192.168.30.89, 192.168.30.91 |

 

 

 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐