Can not add a new image in glance and use it to spawn VM in same template due to image validation
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Heat |
Fix Released
|
Medium
|
Zane Bitter |
Bug Description
I am trying to create a new glance image, a Nova flavor, a new private Neutron network and then boot a couple of VMs using these resources. But stack creation is failing currently as it is trying to validate the image to check if it's a glance.image already and fails since it has not been created yet. IMO when I am using get_resource image ( vis-a-vis get_param image where an already existing glance.image is passed on by user ), Heat orchestration should try to create the image first. Because of this, I am unable to add a new image in glance and then use that image to boot up a VM in a single template.
The exact error received is as following :
=======
$ heat stack-create test1 -f ex0.yaml -e env0.yaml
ERROR: Property error : server1: image Error validating value u'image': The Image (image) could not be found.
The template used :
===============
parameters:
disk_format:
type: string
description: Disk format of image to be used
location:
type: string
description: http location of the image to be used
image_name:
type: string
description: user-defined name for the new image created
disk:
type: number
description: Root disk size in GB to use for VM flavor
ram:
type: number
description: RAM size in MB to use for VM flavor
vcpu:
type: number
description: # of vcpus to be used in VM flavor
public_net:
type: string
description: ID or name of public network for which floating IP addresses will be allocated
vm1_name:
type: string
description: VM1 name
vm2_name:
type: string
description: VM2 name
mgmt_net:
type: string
description: Name of mgmt network to be created
mgmt_subnet_id:
type: string
description: Mgmt network address (CIDR notation)
private_net_name:
type: string
description: Name of private network to be created
private_net_cidr:
type: string
description: Private network address (CIDR notation)
private_
type: string
description: Private network gateway address
private_
type: string
description: Start of private network IP address allocation pool
private_
type: string
description: End of private network IP address allocation pool
resources:
image:
type: OS::Glance::Image
properties:
disk_format: { get_param: disk_format }
container
location: { get_param: location }
name: { get_param: image_name }
flavor:
type: OS::Nova::Flavor
properties:
disk: { get_param: disk }
ram: { get_param: ram }
vcpus: { get_param: vcpu }
private_net:
type: OS::Neutron::Net
properties:
name: { get_param: private_net_name }
private_subnet:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: private_net }
cidr: { get_param: private_net_cidr }
gateway_ip: { get_param: private_net_gateway }
allocatio
- start: { get_param: private_
end: { get_param: private_
server1:
type: OS::Nova::Server
properties:
name: { get_param: vm1_name }
image: { get_resource: image }
flavor: { get_resource: flavor }
networks:
- port: { get_resource: server1_port1 }
- network: { get_resource: private_net }
server1_port1:
type: OS::Neutron::Port
properties:
network_id: { get_param: mgmt_net }
fixed_ips:
- subnet_id: { get_param: mgmt_subnet_id }
security_
server1_
type: OS::Neutron:
properties:
floating_
port_id: { get_resource: server1_port1 }
server2:
type: OS::Nova::Server
properties:
name: { get_param: vm2_name }
image: { get_resource: image }
flavor: { get_resource: flavor }
networks:
- port: { get_resource: server2_port1 }
- network: { get_resource: private_net }
server2_port1:
type: OS::Neutron::Port
properties:
network_id: { get_param: mgmt_net }
fixed_ips:
- subnet_id: { get_param: mgmt_subnet_id }
security_
server2_
type: OS::Neutron:
properties:
floating_
port_id: { get_resource: server2_port1 }
server_
type: OS::Neutron:
properties:
description: Add security group rules for server
name: security-group
rules:
- remote_ip_prefix: 0.0.0.0/0
protocol: tcp
- remote_ip_prefix: 0.0.0.0/0
protocol: icmp
outputs:
server1_
description: IP address of server1 in private network
value: { get_attr: [ server1, first_address ] }
server1_
description: Floating IP address of server1 in public network
value: { get_attr: [ server1_
server2_
description: IP address of server2 in private network
value: { get_attr: [ server2, first_address ] }
server2_
description: Floating IP address of server2 in public network
value: { get_attr: [ server2_
Changed in heat: | |
assignee: | nobody → Angus Salkeld (asalkeld) |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in heat: | |
assignee: | Angus Salkeld (asalkeld) → nobody |
assignee: | nobody → Sergey Kraynev (skraynev) |
Changed in heat: | |
status: | Triaged → In Progress |
Changed in heat: | |
milestone: | none → juno-rc1 |
Changed in heat: | |
milestone: | juno-rc1 → next |
Changed in heat: | |
assignee: | Sergey Kraynev (skraynev) → Zane Bitter (zaneb) |
Changed in heat: | |
milestone: | next → none |
status: | Fix Committed → Fix Released |
I think may be the fllowing patch can solve this problem:
https:/ /review. openstack. org/#/c/ 93080/