daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Sep 4th, 2018 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Sun Sep  2 21:08:57 2018
  4.  
  5. @author: toni
  6. """
  7. import novaclient
  8. import novaclient.client as nvclient
  9. import neutronclient.neutron.client as neutron
  10. from saharaclient.api import client
  11. import keystoneclient.v2_0.client as ksclient
  12. from credentials import get_creds
  13. from credentials import get_nova_creds
  14. from saharaclient.api import images
  15. import glanceclient.v2.client as glclient
  16. keystone = ksclient.Client(**get_creds())
  17. from keystoneauth1.identity import v2
  18. from keystoneauth1 import session as keystone_session
  19.  
  20. sahara_endpoint = keystone.service_catalog.url_for(service_type='data-processing')
  21. neutron_endpoint = keystone.service_catalog.url_for(service_type='network')
  22.  
  23. auth = v2.Password(auth_url=keystone.auth_url,
  24.                    username=keystone.username,
  25.                    password=keystone.password,
  26.                    tenant_name=keystone.tenant_name)
  27. ses = keystone_session.Session(auth=auth)
  28. nova = nvclient.Client('2', session=ses)
  29. sahara_client = client.Client('1.1', session=ses)
  30. glance = glclient.Client(session=ses)
  31. sahara_image = sahara_client.images.update_image('a00b33a2-0eaf-4e23-9ec4-149f3eadbde1', 'ubuntu')
  32. sahara_client.images.update_tags('a00b33a2-0eaf-4e23-9ec4-149f3eadbde1', ['vanilla', '2.7.1'])
  33. ng_master = sahara_client.node_group_templates.create(
  34.             name='toni-master-node2',
  35.             plugin_name='vanilla',
  36.             hadoop_version='2.7.1',
  37.             flavor_id='2',
  38.             node_processes=["namenode", "secondarynamenode" ,"resourcemanager", "historyserver", "oozie"],
  39.             floating_ip_pool='admin_floating_net',
  40.             #security_groups='default',
  41.             image_id='a00b33a2-0eaf-4e23-9ec4-149f3eadbde1'
  42.             )
  43. ng_worker = sahara_client.node_group_templates.create(
  44.             name='toni-worker-node2',
  45.             plugin_name='vanilla',
  46.             hadoop_version='2.7.1',
  47.             flavor_id='2',
  48.             node_processes=["datanode", "nodemanager"],
  49.             floating_ip_pool='admin_floating_net',
  50.             #security_groups='default',
  51.             image_id='a00b33a2-0eaf-4e23-9ec4-149f3eadbde1'
  52.             )
  53.            
  54. cl_template = sahara_client.cluster_templates.create(
  55.             name='toni-hadoop-cluster-template2',
  56.             plugin_name='vanilla',
  57.             hadoop_version='2.7.1',
  58.             )
  59. sahara_client.cluster_templates.update(
  60.             cluster_template_id=cl_template.id,
  61.             node_groups=[
  62.                     dict(
  63.                     name='toni-master-node2',
  64.                     node_group_template_id=ng_master.id,
  65.                     count=1),
  66.                     dict(
  67.                     name='toni-worker-node2',
  68.                     node_group_template_id=ng_worker.id,
  69.                     count=2)
  70.                     ]
  71.                     )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top