Merge "Add support of use_autoconfig field"

This commit is contained in:
Jenkins 2015-08-07 05:26:09 +00:00 committed by Gerrit Code Review
commit afff5823f7
5 changed files with 31 additions and 18 deletions

View File

@ -25,7 +25,8 @@ class ClusterTemplateManager(base.ResourceManager):
def _assign_field(self, name, plugin_name, hadoop_version,
description=None, cluster_configs=None, node_groups=None,
anti_affinity=None, net_id=None, default_image_id=None):
anti_affinity=None, net_id=None, default_image_id=None,
use_autoconfig=None):
data = {
'name': name,
'plugin_name': plugin_name,
@ -38,24 +39,28 @@ class ClusterTemplateManager(base.ResourceManager):
node_groups=node_groups,
anti_affinity=anti_affinity,
neutron_management_network=net_id,
default_image_id=default_image_id)
default_image_id=default_image_id,
use_autoconfig=use_autoconfig)
return data
def create(self, name, plugin_name, hadoop_version, description=None,
cluster_configs=None, node_groups=None, anti_affinity=None,
net_id=None, default_image_id=None):
net_id=None, default_image_id=None, use_autoconfig=None):
data = self._assign_field(name, plugin_name, hadoop_version,
description, cluster_configs, node_groups,
anti_affinity, net_id, default_image_id)
anti_affinity, net_id, default_image_id,
use_autoconfig)
return self._create('/cluster-templates', data, 'cluster_template')
def update(self, cluster_template_id, name, plugin_name, hadoop_version,
description=None, cluster_configs=None, node_groups=None,
anti_affinity=None, net_id=None, default_image_id=None):
anti_affinity=None, net_id=None, default_image_id=None,
use_autoconfig=None):
data = self._assign_field(name, plugin_name, hadoop_version,
description, cluster_configs, node_groups,
anti_affinity, net_id, default_image_id)
anti_affinity, net_id, default_image_id,
use_autoconfig)
return self._update('/cluster-templates/%s' % cluster_template_id,
data, 'cluster_template')

View File

@ -29,7 +29,8 @@ class ClusterManager(base.ResourceManager):
cluster_template_id=None, default_image_id=None,
is_transient=None, description=None, cluster_configs=None,
node_groups=None, user_keypair_id=None,
anti_affinity=None, net_id=None, count=None):
anti_affinity=None, net_id=None, count=None,
use_autoconfig=None):
data = {
'name': name,
@ -53,7 +54,7 @@ class ClusterManager(base.ResourceManager):
user_keypair_id=user_keypair_id,
anti_affinity=anti_affinity,
neutron_management_network=net_id,
count=count)
count=count, use_autoconfig=use_autoconfig)
if count:
return self._create('/clusters/multiple', data)

View File

@ -30,7 +30,7 @@ class NodeGroupTemplateManager(base.ResourceManager):
security_groups=None, auto_security_group=None,
availability_zone=None, volumes_availability_zone=None,
volume_type=None, image_id=None, is_proxy_gateway=None,
volume_local_to_instance=None):
volume_local_to_instance=None, use_autoconfig=None):
data = {
'name': name,
@ -48,7 +48,8 @@ class NodeGroupTemplateManager(base.ResourceManager):
auto_security_group=auto_security_group,
availability_zone=availability_zone,
image_id=image_id,
is_proxy_gateway=is_proxy_gateway
is_proxy_gateway=is_proxy_gateway,
use_autoconfig=use_autoconfig
)
if volumes_per_node:
@ -71,7 +72,7 @@ class NodeGroupTemplateManager(base.ResourceManager):
security_groups=None, auto_security_group=None,
availability_zone=None, volumes_availability_zone=None,
volume_type=None, image_id=None, is_proxy_gateway=None,
volume_local_to_instance=None):
volume_local_to_instance=None, use_autoconfig=None):
data = self._assign_field(name, plugin_name, hadoop_version, flavor_id,
description, volumes_per_node, volumes_size,
@ -80,7 +81,7 @@ class NodeGroupTemplateManager(base.ResourceManager):
auto_security_group, availability_zone,
volumes_availability_zone, volume_type,
image_id, is_proxy_gateway,
volume_local_to_instance)
volume_local_to_instance, use_autoconfig)
return self._create('/node-group-templates', data,
'node_group_template')
@ -92,7 +93,7 @@ class NodeGroupTemplateManager(base.ResourceManager):
auto_security_group=None, availability_zone=None,
volumes_availability_zone=None, volume_type=None,
image_id=None, is_proxy_gateway=None,
volume_local_to_instance=None):
volume_local_to_instance=None, use_autoconfig=None):
data = self._assign_field(name, plugin_name, hadoop_version, flavor_id,
description, volumes_per_node, volumes_size,
@ -101,7 +102,7 @@ class NodeGroupTemplateManager(base.ResourceManager):
auto_security_group, availability_zone,
volumes_availability_zone, volume_type,
image_id, is_proxy_gateway,
volume_local_to_instance)
volume_local_to_instance, use_autoconfig)
return self._update('/node-group-templates/%s' % ng_template_id, data,
'node_group_template')

View File

@ -29,7 +29,8 @@ class ClusterTemplateTest(base.BaseTestCase):
'flavor_id': '2',
'node_processes': ['namenode'],
'count': 1
}
},
"use_autoconfig": False,
}
update_json = {
@ -43,7 +44,8 @@ class ClusterTemplateTest(base.BaseTestCase):
'flavor_id': '3',
'node_processes': ['namenode', 'datanode'],
'count': 1
}
},
"use_autoconfig": True,
}
}
@ -107,7 +109,8 @@ class ClusterTemplateTest(base.BaseTestCase):
node_groups=getattr(resp, "node_groups", None),
anti_affinity=getattr(resp, "anti_affinity", None),
net_id=getattr(resp, "neutron_management_network", None),
default_image_id=getattr(resp, "default_image_id", None)
default_image_id=getattr(resp, "default_image_id", None),
use_autoconfig=True,
)
self.assertIsInstance(updated, ct.ClusterTemplate)

View File

@ -28,6 +28,7 @@ class NodeGroupTemplateTest(base.BaseTestCase):
"volumes_per_node": "3",
"volumes_size": "4",
"node_processes": ["datanode"],
"use_autoconfig": True,
}
update_json = {
@ -40,6 +41,7 @@ class NodeGroupTemplateTest(base.BaseTestCase):
"volumes_per_node": "3",
"volumes_size": "4",
"node_processes": ["datanode", "namenode"],
"use_autoconfig": False,
}
}
@ -113,6 +115,7 @@ class NodeGroupTemplateTest(base.BaseTestCase):
is_proxy_gateway=getattr(resp, "is_proxy_gateway", None),
volume_local_to_instance=getattr(resp,
"volume_local_to_instance",
None))
None),
use_autoconfig=False)
self.assertIsInstance(updated, ng.NodeGroupTemplate)
self.assertFields(self.update_json["node_group_template"], updated)