Support for compute-vmware

New role 'compute-vmware' was introduced. Also vmware deployment
serializer is changed for supporting 'target-node'

Implements: blueprint compute-vmware-role
Change-Id: I4e35f2e980737a0e64abbba585e2f2aaaa3f27c3
This commit is contained in:
Andriy Popovych 2015-07-17 10:40:54 +03:00
parent 8995e80e80
commit 9a2f70a131
4 changed files with 71 additions and 4 deletions

View File

@ -106,6 +106,18 @@
public_ip_required: true
restrictions:
- condition: "not ('advanced' in version:feature_groups)"
compute-vmware:
name: "Compute VMware"
description: "A node that runs nova-compute with VCDriver, that manages ESXi computing resources via VMware vCenter."
weight: 90
conflicts:
- controller
- compute
- cinder
- ceph-osd
- mongo
restrictions:
- condition: "settings:common.use_vcenter.value == false"
action: "hide"
network_roles_metadata:
@ -469,6 +481,8 @@
virt:
- {allocate_size: "min", id: "os"}
- {allocate_size: "all", id: "vm"}
compute-vmware:
- {allocate_size: "min", id: "os"}
volumes:
- id: "os"
type: "vg"
@ -1355,6 +1369,14 @@
regex:
source: *non_empty_string
error: "Invalid datastore regex"
-
name: "target_node"
type: "select"
label: "Target node"
description: "Target node for nova-compute service"
regex:
source: *non_empty_string
error: "Empty target node"
-
name: "network"
type: "object"
@ -1429,6 +1451,7 @@
vsphere_cluster: ""
service_name: ""
datastore_regex: ""
target_node: "controllers"
cinder:
enable: true
network:

View File

@ -51,6 +51,12 @@
"description": "Datastore regex",
"name": "datastore_regex",
"label": "Datastore regex"
},
{
"type": "select",
"description": "Target node for nova-compute service",
"name": "target_node",
"label": "Target node"
}
],
"type": "array",
@ -146,12 +152,22 @@
{
"vsphere_cluster": "cluster1",
"service_name": "Compute 1",
"datastore_regex": ""
"datastore_regex": "",
"target_node": {
"current": {
"id": "test_target_node"
}
}
},
{
"vsphere_cluster": "cluster2",
"service_name": "Compute 3",
"datastore_regex": ""
"datastore_regex": "",
"target_node": {
"current": {
"id": "test_target_node"
}
}
}
]
},

View File

@ -51,7 +51,13 @@ class VmwareDeploymentSerializerMixin(object):
"""Extend serialize data with vmware attributes
"""
vmware_data = {}
allowed_roles = ['controller', 'primary-controller', 'cinder-vmware']
allowed_roles = [
'controller',
'primary-controller',
'compute-vmware',
'cinder-vmware'
]
all_roles = Node.all_roles(node)
use_vcenter = node.cluster.attributes.editable.get('common', {}) \
.get('use_vcenter', {}).get('value')
@ -84,7 +90,9 @@ class VmwareDeploymentSerializerMixin(object):
'vc_password': vc_password,
'service_name': compute.get('service_name', ''),
'vc_cluster': compute.get('vsphere_cluster', ''),
'datastore_regex': datastore_regex
'datastore_regex': datastore_regex,
'target_node': compute.get('target_node', {}).get(
'current', {}).get('id', 'controllers')
}
compute_instances.append(compute_item)

View File

@ -187,6 +187,16 @@ class TestDeploymentAttributesSerialization70(
def test_generate_vmware_attributes_data(self):
self.check_generate_vmware_attributes_data()
result = self.serializer.serialize_node(
self.env.nodes[0], 'compute-vmware')
self.assertEqual(
result['vcenter']['computes'][0]['target_node'],
"test_target_node")
self.assertEqual(
result['vcenter']['computes'][2]['target_node'],
"controllers")
class TestDeploymentAttributesSerializationSegmentationGre70(
TestDeploymentAttributesSerialization70
@ -348,6 +358,16 @@ class TestDeploymentSerializationForNovaNetwork70(BaseDeploymentSerializer):
def test_generate_vmware_attributes_data(self):
self.check_generate_vmware_attributes_data()
result = self.serializer.serialize_node(
self.env.nodes[0], 'compute-vmware')
self.assertEqual(
result['vcenter']['computes'][0]['target_node'],
"test_target_node")
self.assertEqual(
result['vcenter']['computes'][2]['target_node'],
"controllers")
class TestPluginDeploymentTasksInjection(base.BaseIntegrationTest):