Merge "Switched heat engine from JSON to HOT"

This commit is contained in:
Jenkins 2015-04-10 13:00:56 +00:00 committed by Gerrit Code Review
commit 882328204c
8 changed files with 334 additions and 479 deletions

View File

@ -35,7 +35,7 @@ LOG = logging.getLogger(__name__)
class HeatEngine(e.Engine):
def get_type_and_version(self):
return "heat.1.2"
return "heat.2.0"
def _add_volumes(self, ctx, cluster):
for instance in g.get_instances(cluster):

View File

@ -13,11 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import json
from oslo_config import cfg
from oslo_log import log as logging
import six
import yaml
from sahara.utils import general as g
from sahara.utils.openstack import heat as h
@ -71,11 +71,11 @@ class ClusterTemplate(object):
}
def _get_main_template(self):
return json.dumps({
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Data Processing Cluster by Sahara",
"Resources": self._serialize_resources(),
"Outputs": {}
return yaml.safe_dump({
"heat_template_version": "2013-05-23",
"description": "Data Processing Cluster by Sahara",
"resources": self._serialize_resources(),
"outputs": {}
})
def instantiate(self, update_existing, disable_rollback=True):
@ -136,8 +136,8 @@ class ClusterTemplate(object):
return {
security_group_name: {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"type": "AWS::EC2::SecurityGroup",
"properties": {
"GroupDescription": security_group_description,
"SecurityGroupIngress": rules
}
@ -213,8 +213,8 @@ class ClusterTemplate(object):
resources.update({
inst_name: {
"Type": "OS::Nova::Server",
"Properties": properties
"type": "OS::Nova::Server",
"properties": properties
}
})
@ -235,8 +235,8 @@ class ClusterTemplate(object):
return {
port_name: {
"Type": "OS::Neutron::Port",
"Properties": properties
"type": "OS::Neutron::Port",
"properties": properties
}
}
@ -246,8 +246,8 @@ class ClusterTemplate(object):
return {
floating_ip_name: {
"Type": "OS::Neutron::FloatingIP",
"Properties": {
"type": "OS::Neutron::FloatingIP",
"properties": {
"floating_network_id": floating_net_id,
"port_id": {"Ref": port_name}
}
@ -259,14 +259,14 @@ class ClusterTemplate(object):
floating_ip_assoc_name = _get_floating_assoc_name(inst_name)
return {
floating_ip_name: {
"Type": "OS::Nova::FloatingIP",
"Properties": {
"type": "OS::Nova::FloatingIP",
"properties": {
"pool": floating_pool_name
}
},
floating_ip_assoc_name: {
"Type": "OS::Nova::FloatingIPAssociation",
"Properties": {
"type": "OS::Nova::FloatingIPAssociation",
"properties": {
"floating_ip": {"Ref": floating_ip_name},
"server_id": {"Ref": inst_name}
}
@ -292,12 +292,12 @@ class ClusterTemplate(object):
return {
volume_name: {
"Type": "OS::Cinder::Volume",
"Properties": properties
"type": "OS::Cinder::Volume",
"properties": properties
},
volume_attach_name: {
"Type": "OS::Cinder::VolumeAttachment",
"Properties": {
"type": "OS::Cinder::VolumeAttachment",
"properties": {
"instance_uuid": {"Ref": inst_name},
"volume_id": {"Ref": volume_name},
"mountpoint": None
@ -316,8 +316,8 @@ class ClusterTemplate(object):
server_group_name = _get_aa_group_name(self.cluster.name)
return {
server_group_name: {
"Type": "OS::Nova::ServerGroup",
"Properties": {
"type": "OS::Nova::ServerGroup",
"properties": {
"name": server_group_name,
"policies": ["anti-affinity"]
}

View File

@ -1,96 +1,76 @@
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Data Processing Cluster by Sahara",
description: Data Processing Cluster by Sahara
heat_template_version: '2013-05-23'
outputs: {}
resources:
cluster-aa-group:
properties:
name: cluster-aa-group
policies: [anti-affinity]
type: OS::Nova::ServerGroup
cluster-master-001:
properties:
admin_user: root
flavor: '42'
image: '1'
key_name: user_key
name: cluster-master-001
networks:
- port: {Ref: cluster-master-001-port}
user_data: 'line1
"Resources" : {
"cluster-aa-group" : {
"Type" : "OS::Nova::ServerGroup",
"Properties" : {
"name" : "cluster-aa-group",
"policies": ["anti-affinity"]
}
},
"cluster-worker-001-port" : {
"Type" : "OS::Neutron::Port",
"Properties" : {
"network_id" : "private_net",
"replacement_policy": "AUTO"
}
},
"cluster-worker-001-floating" : {
"Type" : "OS::Neutron::FloatingIP" ,
"Properties" : {
"floating_network_id" : "floating",
"port_id" : { "Ref" : "cluster-worker-001-port" }
}
},
"cluster-worker-001" : {
"Type" : "OS::Nova::Server",
"Properties" : {
"name" : "cluster-worker-001",
"flavor" : "42",
"image" : "1",
"admin_user": "root",
"networks" : [{ "port" : { "Ref" : "cluster-worker-001-port" }}],
"key_name" : "user_key",
"scheduler_hints" : {"group": {"Ref": "cluster-aa-group"}},
"user_data": "line2\nline3"
}
},
"cluster-worker-002-port" : {
"Type" : "OS::Neutron::Port",
"Properties" : {
"network_id" : "private_net",
"replacement_policy": "AUTO"
}
},
"cluster-worker-002-floating" : {
"Type" : "OS::Neutron::FloatingIP" ,
"Properties" : {
"floating_network_id" : "floating",
"port_id" : { "Ref" : "cluster-worker-002-port" }
}
},
"cluster-worker-002" : {
"Type" : "OS::Nova::Server",
"Properties" : {
"name" : "cluster-worker-002",
"flavor" : "42",
"image" : "1",
"admin_user": "root",
"networks" : [{ "port" : { "Ref" : "cluster-worker-002-port" }}],
"key_name" : "user_key",
"scheduler_hints" : {"group": {"Ref": "cluster-aa-group"}},
"user_data": "line2\nline3"
}
},
"cluster-master-001-port" : {
"Type" : "OS::Neutron::Port",
"Properties" : {
"network_id" : "private_net",
"replacement_policy": "AUTO"
}
},
"cluster-master-001-floating" : {
"Type" : "OS::Neutron::FloatingIP" ,
"Properties" : {
"floating_network_id" : "floating",
"port_id" : { "Ref" : "cluster-master-001-port" }
}
},
"cluster-master-001" : {
"Type" : "OS::Nova::Server",
"Properties" : {
"name" : "cluster-master-001",
"flavor" : "42",
"image" : "1",
"admin_user": "root",
"networks" : [{ "port" : { "Ref" : "cluster-master-001-port" }}],
"key_name" : "user_key",
"user_data" : "line1\nline2"
}
}
},
line2'
type: OS::Nova::Server
cluster-master-001-floating:
properties:
floating_network_id: floating
port_id: {Ref: cluster-master-001-port}
type: OS::Neutron::FloatingIP
cluster-master-001-port:
properties: {network_id: private_net, replacement_policy: AUTO}
type: OS::Neutron::Port
cluster-worker-001:
properties:
admin_user: root
flavor: '42'
image: '1'
key_name: user_key
name: cluster-worker-001
networks:
- port: {Ref: cluster-worker-001-port}
scheduler_hints:
group: {Ref: cluster-aa-group}
user_data: 'line2
"Outputs" : {}
}
line3'
type: OS::Nova::Server
cluster-worker-001-floating:
properties:
floating_network_id: floating
port_id: {Ref: cluster-worker-001-port}
type: OS::Neutron::FloatingIP
cluster-worker-001-port:
properties: {network_id: private_net, replacement_policy: AUTO}
type: OS::Neutron::Port
cluster-worker-002:
properties:
admin_user: root
flavor: '42'
image: '1'
key_name: user_key
name: cluster-worker-002
networks:
- port: {Ref: cluster-worker-002-port}
scheduler_hints:
group: {Ref: cluster-aa-group}
user_data: 'line2
line3'
type: OS::Nova::Server
cluster-worker-002-floating:
properties:
floating_network_id: floating
port_id: {Ref: cluster-worker-002-port}
type: OS::Neutron::FloatingIP
cluster-worker-002-port:
properties: {network_id: private_net, replacement_policy: AUTO}
type: OS::Neutron::Port

View File

@ -1,93 +1,64 @@
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Data Processing Cluster by Sahara",
description: Data Processing Cluster by Sahara
heat_template_version: '2013-05-23'
outputs: {}
resources:
cluster-master-001:
properties:
admin_user: root
flavor: '42'
image: '1'
key_name: user_key
name: cluster-master-001
networks:
- port: {Ref: cluster-master-001-port}
user_data: 'line1
"Resources" : {
"cluster-worker-001-port" : {
"Type" : "OS::Neutron::Port",
"Properties" : {
"network_id" : "private_net",
"replacement_policy": "AUTO"
}
},
"cluster-worker-001-floating" : {
"Type" : "OS::Neutron::FloatingIP" ,
"Properties" : {
"floating_network_id" : "floating",
"port_id" : { "Ref" : "cluster-worker-001-port" }
}
},
"cluster-worker-001" : {
"Type" : "OS::Nova::Server",
"Properties" : {
"name" : "cluster-worker-001",
"flavor" : "42",
"image" : "1",
"admin_user": "root",
"networks" : [{ "port" : { "Ref" : "cluster-worker-001-port" }}],
"key_name" : "user_key",
"user_data": "line2\nline3"
}
},
"cluster-worker-001-volume-0" : {
"Type" : "OS::Cinder::Volume",
"Properties" : {
"name" : "cluster-worker-001-volume-0",
"size" : "10",
"volume_type" : "vol_type"
}
},
"cluster-worker-001-volume-attachment-0" : {
"Type" : "OS::Cinder::VolumeAttachment",
"Properties" : {
"instance_uuid" : { "Ref" : "cluster-worker-001" },
"volume_id" : { "Ref" : "cluster-worker-001-volume-0" },
"mountpoint" : null
}
},
"cluster-worker-001-volume-1" : {
"Type" : "OS::Cinder::Volume",
"Properties" : {
"name" : "cluster-worker-001-volume-1",
"size" : "10",
"volume_type": "vol_type"
}
},
"cluster-worker-001-volume-attachment-1" : {
"Type" : "OS::Cinder::VolumeAttachment",
"Properties" : {
"instance_uuid" : { "Ref" : "cluster-worker-001" },
"volume_id" : { "Ref" : "cluster-worker-001-volume-1" },
"mountpoint" : null
}
},
"cluster-master-001-port" : {
"Type" : "OS::Neutron::Port",
"Properties" : {
"network_id" : "private_net",
"replacement_policy": "AUTO"
}
},
"cluster-master-001-floating" : {
"Type" : "OS::Neutron::FloatingIP" ,
"Properties" : {
"floating_network_id" : "floating",
"port_id" : { "Ref" : "cluster-master-001-port" }
}
},
"cluster-master-001" : {
"Type" : "OS::Nova::Server",
"Properties" : {
"name" : "cluster-master-001",
"flavor" : "42",
"image" : "1",
"admin_user": "root",
"networks" : [{ "port" : { "Ref" : "cluster-master-001-port" }}],
"key_name" : "user_key",
"user_data": "line1\nline2"
}
}
},
line2'
type: OS::Nova::Server
cluster-master-001-floating:
properties:
floating_network_id: floating
port_id: {Ref: cluster-master-001-port}
type: OS::Neutron::FloatingIP
cluster-master-001-port:
properties: {network_id: private_net, replacement_policy: AUTO}
type: OS::Neutron::Port
cluster-worker-001:
properties:
admin_user: root
flavor: '42'
image: '1'
key_name: user_key
name: cluster-worker-001
networks:
- port: {Ref: cluster-worker-001-port}
user_data: 'line2
"Outputs" : {}
}
line3'
type: OS::Nova::Server
cluster-worker-001-floating:
properties:
floating_network_id: floating
port_id: {Ref: cluster-worker-001-port}
type: OS::Neutron::FloatingIP
cluster-worker-001-port:
properties: {network_id: private_net, replacement_policy: AUTO}
type: OS::Neutron::Port
cluster-worker-001-volume-0:
properties: {name: cluster-worker-001-volume-0, size: '10', volume_type: vol_type}
type: OS::Cinder::Volume
cluster-worker-001-volume-1:
properties: {name: cluster-worker-001-volume-1, size: '10', volume_type: vol_type}
type: OS::Cinder::Volume
cluster-worker-001-volume-attachment-0:
properties:
instance_uuid: {Ref: cluster-worker-001}
mountpoint: null
volume_id: {Ref: cluster-worker-001-volume-0}
type: OS::Cinder::VolumeAttachment
cluster-worker-001-volume-attachment-1:
properties:
instance_uuid: {Ref: cluster-worker-001}
mountpoint: null
volume_id: {Ref: cluster-worker-001-volume-1}
type: OS::Cinder::VolumeAttachment

View File

@ -1,63 +1,34 @@
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Data Processing Cluster by Sahara",
description: Data Processing Cluster by Sahara
heat_template_version: '2013-05-23'
outputs: {}
resources:
cluster-master-001:
properties: {admin_user: root, flavor: '42', image: '1', key_name: user_key, name: cluster-master-001,
user_data: 'line1
"Resources" : {
"cluster-worker-001" : {
"Type" : "OS::Nova::Server",
"Properties" : {
"name" : "cluster-worker-001",
"flavor" : "42",
"image" : "1",
"admin_user": "root",
"key_name" : "user_key",
"user_data": "line2\nline3"
}
},
"cluster-worker-001-volume-0" : {
"Type" : "OS::Cinder::Volume",
"Properties" : {
"name" : "cluster-worker-001-volume-0",
"size" : "10",
"volume_type": null
}
},
"cluster-worker-001-volume-attachment-0" : {
"Type" : "OS::Cinder::VolumeAttachment",
"Properties" : {
"instance_uuid" : { "Ref" : "cluster-worker-001" },
"volume_id" : { "Ref" : "cluster-worker-001-volume-0" },
"mountpoint" : null
}
},
"cluster-worker-001-volume-1" : {
"Type" : "OS::Cinder::Volume",
"Properties" : {
"name" : "cluster-worker-001-volume-1",
"size" : "10",
"volume_type": null
}
},
"cluster-worker-001-volume-attachment-1" : {
"Type" : "OS::Cinder::VolumeAttachment",
"Properties" : {
"instance_uuid" : { "Ref" : "cluster-worker-001" },
"volume_id" : { "Ref" : "cluster-worker-001-volume-1" },
"mountpoint" : null
}
},
"cluster-master-001" : {
"Type" : "OS::Nova::Server",
"Properties" : {
"name" : "cluster-master-001",
"flavor" : "42",
"image" : "1",
"admin_user": "root",
"key_name" : "user_key",
"user_data": "line1\nline2"
}
}
},
line2'}
type: OS::Nova::Server
cluster-worker-001:
properties: {admin_user: root, flavor: '42', image: '1', key_name: user_key, name: cluster-worker-001,
user_data: 'line2
"Outputs" : {}
}
line3'}
type: OS::Nova::Server
cluster-worker-001-volume-0:
properties: {name: cluster-worker-001-volume-0, size: '10', volume_type: null}
type: OS::Cinder::Volume
cluster-worker-001-volume-1:
properties: {name: cluster-worker-001-volume-1, size: '10', volume_type: null}
type: OS::Cinder::Volume
cluster-worker-001-volume-attachment-0:
properties:
instance_uuid: {Ref: cluster-worker-001}
mountpoint: null
volume_id: {Ref: cluster-worker-001-volume-0}
type: OS::Cinder::VolumeAttachment
cluster-worker-001-volume-attachment-1:
properties:
instance_uuid: {Ref: cluster-worker-001}
mountpoint: null
volume_id: {Ref: cluster-worker-001-volume-1}
type: OS::Cinder::VolumeAttachment

View File

@ -1,89 +1,50 @@
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Data Processing Cluster by Sahara",
description: Data Processing Cluster by Sahara
heat_template_version: '2013-05-23'
outputs: {}
resources:
cluster-master-001:
properties: {admin_user: root, flavor: '42', image: '1', key_name: user_key, name: cluster-master-001,
user_data: 'line1
"Resources" : {
"cluster-worker-001-floating-assoc" : {
"Type" : "OS::Nova::FloatingIPAssociation",
"Properties" : {
"floating_ip" : { "Ref" : "cluster-worker-001-floating" },
"server_id" : { "Ref" : "cluster-worker-001" }
}
},
"cluster-worker-001-floating" : {
"Type" : "OS::Nova::FloatingIP",
"Properties" : {
"pool" : "floating"
}
},
"cluster-worker-001" : {
"Type" : "OS::Nova::Server",
"Properties" : {
"name" : "cluster-worker-001",
"flavor" : "42",
"image" : "1",
"admin_user": "root",
"key_name" : "user_key",
"user_data": "line2\nline3"
}
},
"cluster-worker-001-volume-0" : {
"Type" : "OS::Cinder::Volume",
"Properties" : {
"name" : "cluster-worker-001-volume-0",
"size" : "10",
"volume_type": null
}
},
"cluster-worker-001-volume-attachment-0" : {
"Type" : "OS::Cinder::VolumeAttachment",
"Properties" : {
"instance_uuid" : { "Ref" : "cluster-worker-001" },
"volume_id" : { "Ref" : "cluster-worker-001-volume-0" },
"mountpoint" : null
}
},
"cluster-worker-001-volume-1" : {
"Type" : "OS::Cinder::Volume",
"Properties" : {
"name" : "cluster-worker-001-volume-1",
"size" : "10",
"volume_type": null
}
},
"cluster-worker-001-volume-attachment-1" : {
"Type" : "OS::Cinder::VolumeAttachment",
"Properties" : {
"instance_uuid" : { "Ref" : "cluster-worker-001" },
"volume_id" : { "Ref" : "cluster-worker-001-volume-1" },
"mountpoint" : null
}
},
"cluster-master-001-floating-assoc" : {
"Type" : "OS::Nova::FloatingIPAssociation",
"Properties" : {
"floating_ip" : { "Ref" : "cluster-master-001-floating" },
"server_id" : { "Ref" : "cluster-master-001" }
}
},
"cluster-master-001-floating" : {
"Type" : "OS::Nova::FloatingIP",
"Properties" : {
"pool" : "floating"
}
},
"cluster-master-001" : {
"Type" : "OS::Nova::Server",
"Properties" : {
"name" : "cluster-master-001",
"flavor" : "42",
"image" : "1",
"admin_user": "root",
"key_name" : "user_key",
"user_data": "line1\nline2"
}
}
},
line2'}
type: OS::Nova::Server
cluster-master-001-floating:
properties: {pool: floating}
type: OS::Nova::FloatingIP
cluster-master-001-floating-assoc:
properties:
floating_ip: {Ref: cluster-master-001-floating}
server_id: {Ref: cluster-master-001}
type: OS::Nova::FloatingIPAssociation
cluster-worker-001:
properties: {admin_user: root, flavor: '42', image: '1', key_name: user_key, name: cluster-worker-001,
user_data: 'line2
"Outputs" : {}
}
line3'}
type: OS::Nova::Server
cluster-worker-001-floating:
properties: {pool: floating}
type: OS::Nova::FloatingIP
cluster-worker-001-floating-assoc:
properties:
floating_ip: {Ref: cluster-worker-001-floating}
server_id: {Ref: cluster-worker-001}
type: OS::Nova::FloatingIPAssociation
cluster-worker-001-volume-0:
properties: {name: cluster-worker-001-volume-0, size: '10', volume_type: null}
type: OS::Cinder::Volume
cluster-worker-001-volume-1:
properties: {name: cluster-worker-001-volume-1, size: '10', volume_type: null}
type: OS::Cinder::Volume
cluster-worker-001-volume-attachment-0:
properties:
instance_uuid: {Ref: cluster-worker-001}
mountpoint: null
volume_id: {Ref: cluster-worker-001-volume-0}
type: OS::Cinder::VolumeAttachment
cluster-worker-001-volume-attachment-1:
properties:
instance_uuid: {Ref: cluster-worker-001}
mountpoint: null
volume_id: {Ref: cluster-worker-001-volume-1}
type: OS::Cinder::VolumeAttachment

View File

@ -1,110 +1,83 @@
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Data Processing Cluster by Sahara",
description: Data Processing Cluster by Sahara
heat_template_version: '2013-05-23'
outputs: {}
resources:
cluster-master-001:
properties:
admin_user: root
flavor: '42'
image: '1'
key_name: user_key
name: cluster-master-001
networks:
- port: {Ref: cluster-master-001-port}
user_data: 'line1
"Resources" : {
"cluster-worker-001-port" : {
"Type" : "OS::Neutron::Port",
"Properties" : {
"network_id" : "private_net",
"replacement_policy": "AUTO"
}
},
"cluster-worker-001-floating" : {
"Type" : "OS::Neutron::FloatingIP" ,
"Properties" : {
"floating_network_id" : "floating",
"port_id" : { "Ref" : "cluster-worker-001-port" }
}
},
"cluster-worker-001" : {
"Type" : "OS::Nova::Server",
"Properties" : {
"name" : "cluster-worker-001",
"flavor" : "42",
"image" : "1",
"admin_user": "root",
"networks" : [{ "port" : { "Ref" : "cluster-worker-001-port" }}],
"key_name" : "user_key",
"user_data": "line2\nline3"
}
},
"cluster-worker-001-volume-0" : {
"Type" : "OS::Cinder::Volume",
"Properties" : {
"name" : "cluster-worker-001-volume-0",
"size" : "10",
"scheduler_hints": {"local_to_instance": {"Ref": "cluster-worker-001"}},
"volume_type" : "vol_type"
}
},
"cluster-worker-001-volume-attachment-0" : {
"Type" : "OS::Cinder::VolumeAttachment",
"Properties" : {
"instance_uuid" : { "Ref" : "cluster-worker-001" },
"volume_id" : { "Ref" : "cluster-worker-001-volume-0" },
"mountpoint" : null
}
},
"cluster-worker-001-volume-1" : {
"Type" : "OS::Cinder::Volume",
"Properties" : {
"name" : "cluster-worker-001-volume-1",
"size" : "10",
"scheduler_hints": {"local_to_instance": {"Ref": "cluster-worker-001"}},
"volume_type": "vol_type"
}
},
"cluster-worker-001-volume-attachment-1" : {
"Type" : "OS::Cinder::VolumeAttachment",
"Properties" : {
"instance_uuid" : { "Ref" : "cluster-worker-001" },
"volume_id" : { "Ref" : "cluster-worker-001-volume-1" },
"mountpoint" : null
}
},
"cluster-master-001-port" : {
"Type" : "OS::Neutron::Port",
"Properties" : {
"network_id" : "private_net",
"replacement_policy": "AUTO"
}
},
"cluster-master-001-floating" : {
"Type" : "OS::Neutron::FloatingIP" ,
"Properties" : {
"floating_network_id" : "floating",
"port_id" : { "Ref" : "cluster-master-001-port" }
}
},
"cluster-master-001" : {
"Type" : "OS::Nova::Server",
"Properties" : {
"name" : "cluster-master-001",
"flavor" : "42",
"image" : "1",
"admin_user": "root",
"networks" : [{ "port" : { "Ref" : "cluster-master-001-port" }}],
"key_name" : "user_key",
"user_data": "line1\nline2"
}
},
"cluster-master-001-volume-0": {
"Type": "OS::Cinder::Volume",
"Properties": {
"name": "cluster-master-001-volume-0",
"size": "10",
"volume_type": null
}
},
"cluster-master-001-volume-attachment-0": {
"Type": "OS::Cinder::VolumeAttachment",
"Properties": {
"instance_uuid": {"Ref": "cluster-master-001"},
"volume_id": {"Ref": "cluster-master-001-volume-0"},
"mountpoint": null}
}
},
line2'
type: OS::Nova::Server
cluster-master-001-floating:
properties:
floating_network_id: floating
port_id: {Ref: cluster-master-001-port}
type: OS::Neutron::FloatingIP
cluster-master-001-port:
properties: {network_id: private_net, replacement_policy: AUTO}
type: OS::Neutron::Port
cluster-master-001-volume-0:
properties: {name: cluster-master-001-volume-0, size: '10', volume_type: null}
type: OS::Cinder::Volume
cluster-master-001-volume-attachment-0:
properties:
instance_uuid: {Ref: cluster-master-001}
mountpoint: null
volume_id: {Ref: cluster-master-001-volume-0}
type: OS::Cinder::VolumeAttachment
cluster-worker-001:
properties:
admin_user: root
flavor: '42'
image: '1'
key_name: user_key
name: cluster-worker-001
networks:
- port: {Ref: cluster-worker-001-port}
user_data: 'line2
"Outputs" : {}
}
line3'
type: OS::Nova::Server
cluster-worker-001-floating:
properties:
floating_network_id: floating
port_id: {Ref: cluster-worker-001-port}
type: OS::Neutron::FloatingIP
cluster-worker-001-port:
properties: {network_id: private_net, replacement_policy: AUTO}
type: OS::Neutron::Port
cluster-worker-001-volume-0:
properties:
name: cluster-worker-001-volume-0
scheduler_hints:
local_to_instance: {Ref: cluster-worker-001}
size: '10'
volume_type: vol_type
type: OS::Cinder::Volume
cluster-worker-001-volume-1:
properties:
name: cluster-worker-001-volume-1
scheduler_hints:
local_to_instance: {Ref: cluster-worker-001}
size: '10'
volume_type: vol_type
type: OS::Cinder::Volume
cluster-worker-001-volume-attachment-0:
properties:
instance_uuid: {Ref: cluster-worker-001}
mountpoint: null
volume_id: {Ref: cluster-worker-001-volume-0}
type: OS::Cinder::VolumeAttachment
cluster-worker-001-volume-attachment-1:
properties:
instance_uuid: {Ref: cluster-worker-001}
mountpoint: null
volume_id: {Ref: cluster-worker-001-volume-1}
type: OS::Cinder::VolumeAttachment

View File

@ -13,9 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import json
import testtools
import yaml
from sahara.service.heat import templates as h
from sahara.tests.unit import base
@ -110,10 +109,10 @@ class TestClusterTemplate(base.SaharaWithDbTestCase):
main_template = heat_template._get_main_template()
self.assertEqual(
json.loads(f.get_file_text(
yaml.load(f.get_file_text(
"tests/unit/resources/"
"test_serialize_resources_use_neutron.heat")),
json.loads(main_template)
yaml.load(main_template)
)
def test_load_template_use_nova_network_without_autoassignment(self):
@ -132,10 +131,10 @@ class TestClusterTemplate(base.SaharaWithDbTestCase):
main_template = heat_template._get_main_template()
self.assertEqual(
json.loads(f.get_file_text(
yaml.load(f.get_file_text(
"tests/unit/resources/test_serialize_"
"resources_use_nn_without_autoassignment.heat")),
json.loads(main_template)
yaml.load(main_template)
)
def test_load_template_use_nova_network_with_autoassignment(self):
@ -154,10 +153,10 @@ class TestClusterTemplate(base.SaharaWithDbTestCase):
main_template = heat_template._get_main_template()
self.assertEqual(
json.loads(f.get_file_text(
yaml.load(f.get_file_text(
"tests/unit/resources/"
"test_serialize_resources_use_nn_with_autoassignment.heat")),
json.loads(main_template)
yaml.load(main_template)
)
def test_load_template_with_anti_affinity_single_ng(self):
@ -191,11 +190,11 @@ class TestClusterTemplate(base.SaharaWithDbTestCase):
main_template = aa_heat_template._get_main_template()
self.assertEqual(
json.loads(f.get_file_text(
yaml.load(f.get_file_text(
"tests/unit/resources/"
"test_serialize_resources_aa.heat")),
json.loads(main_template)
)
yaml.load(main_template)
)
def test_load_template_with_volume_local_to_instance(self):
"""Checks Heat cluster template with Neutron enabled.
@ -229,10 +228,10 @@ class TestClusterTemplate(base.SaharaWithDbTestCase):
main_template = heat_template._get_main_template()
self.assertEqual(
json.loads(f.get_file_text(
yaml.load(f.get_file_text(
"tests/unit/resources/"
"test_serialize_resources_volume_local_to_instance.heat")),
json.loads(main_template))
yaml.load(main_template))
def get_ud_generator(s):