Browse code

Merge redux branch (keystone light)

Change-Id: I2cb5b198a06848f42f919ea49e338443131e263e

James E. Blair authored on 2012/02/15 08:56:37
Showing 8 changed files
... ...
@@ -12,4 +12,4 @@ python-greenlet
12 12
 python-routes
13 13
 libldap2-dev
14 14
 libsasl2-dev
15
-
15
+python-bcrypt
16 16
new file mode 100644
... ...
@@ -0,0 +1,30 @@
0
+# config for TemplatedCatalog, using camelCase because I don't want to do
1
+# translations for legacy compat
2
+catalog.RegionOne.identity.publicURL = http://%SERVICE_HOST%:$(public_port)s/v2.0
3
+catalog.RegionOne.identity.adminURL = http://%SERVICE_HOST%:$(admin_port)s/v2.0
4
+catalog.RegionOne.identity.internalURL = http://%SERVICE_HOST%:$(public_port)s/v2.0
5
+catalog.RegionOne.identity.name = 'Identity Service'
6
+
7
+
8
+catalog.RegionOne.compute.publicURL = http://%SERVICE_HOST%:8774/v1.1/$(tenant_id)s
9
+catalog.RegionOne.compute.adminURL = http://%SERVICE_HOST%:8774/v1.1/$(tenant_id)s
10
+catalog.RegionOne.compute.internalURL = http://%SERVICE_HOST%:8774/v1.1/$(tenant_id)s
11
+catalog.RegionOne.compute.name = 'Compute Service'
12
+
13
+
14
+catalog.RegionOne.ec2.publicURL = http://%SERVICE_HOST%:8773/services/Cloud
15
+catalog.RegionOne.ec2.adminURL = http://%SERVICE_HOST%:8773/services/Admin
16
+catalog.RegionOne.ec2.internalURL = http://%SERVICE_HOST%:8773/services/Cloud
17
+catalog.RegionOne.ec2.name = 'EC2 Service'
18
+
19
+
20
+catalog.RegionOne.image.publicURL = http://%SERVICE_HOST%:9292/v1
21
+catalog.RegionOne.image.adminURL = http://%SERVICE_HOST%:9292/v1
22
+catalog.RegionOne.image.internalURL = http://%SERVICE_HOST%:9292/v1
23
+catalog.RegionOne.image.name = 'Image Service'
24
+
25
+
26
+catalog.RegionOne.object_store.publicURL = http://%SERVICE_HOST%:8080/v1/AUTH_$(tenant_id)s
27
+catalog.RegionOne.object_store.adminURL = http://%SERVICE_HOST%:8080/
28
+catalog.RegionOne.object_store.internalURL = http://%SERVICE_HOST%:8080/v1/AUTH_$(tenant_id)s
29
+catalog.RegionOne.object_store.name = 'Swift Service'
... ...
@@ -1,112 +1,92 @@
1 1
 [DEFAULT]
2
-# Show more verbose log output (sets INFO log level output)
3
-verbose = False
4
-
5
-# Show debugging output in logs (sets DEBUG log level output)
6
-debug = False
7
-
8
-# Which backend store should Keystone use by default.
9
-# Default: 'sqlite'
10
-# Available choices are 'sqlite' [future will include LDAP, PAM, etc]
11
-default_store = sqlite
12
-
13
-# Log to this file. Make sure you do not set the same log
14
-# file for both the API and registry servers!
15
-log_file = %DEST%/keystone/keystone.log
16
-
17
-# List of backends to be configured
18
-backends = keystone.backends.sqlalchemy
19
-#For LDAP support, add: ,keystone.backends.ldap
2
+public_port = 5000
3
+admin_port = 35357
4
+admin_token = %SERVICE_TOKEN%
5
+compute_port = 3000
6
+verbose = True
7
+debug = True
8
+# commented out so devstack logs to stdout
9
+# log_file = %DEST%/keystone/keystone.log
20 10
 
21
-# Dictionary Maps every service to a header.Missing services would get header
22
-# X_(SERVICE_NAME) Key => Service Name, Value => Header Name
23
-service_header_mappings = {
24
-	'nova' : 'X-Server-Management-Url',
25
-	'swift' : 'X-Storage-Url',
26
-	'cdn' : 'X-CDN-Management-Url'}
11
+# ================= Syslog Options ============================
12
+# Send logs to syslog (/dev/log) instead of to file specified
13
+# by `log-file`
14
+use_syslog = False
27 15
 
28
-#List of extensions currently supported
29
-extensions= osksadm,oskscatalog
16
+# Facility to use. If unset defaults to LOG_USER.
17
+# syslog_log_facility = LOG_LOCAL0
30 18
 
31
-# Address to bind the API server
32
-# TODO Properties defined within app not available via pipeline.
33
-service_host = 0.0.0.0
19
+[sql]
20
+connection = %SQL_CONN%
21
+idle_timeout = 30
22
+min_pool_size = 5
23
+max_pool_size = 10
24
+pool_timeout = 200
34 25
 
35
-# Port the bind the API server to
36
-service_port = 5000
26
+[identity]
27
+driver = keystone.identity.backends.sql.Identity
37 28
 
38
-# SSL for API server
39
-service_ssl = False
29
+[catalog]
30
+driver = keystone.catalog.backends.templated.TemplatedCatalog
31
+template_file = %KEYSTONE_DIR%/etc/default_catalog.templates
40 32
 
41
-# Address to bind the Admin API server
42
-admin_host = 0.0.0.0
33
+[token]
34
+driver = keystone.token.backends.kvs.Token
43 35
 
44
-# Port the bind the Admin API server to
45
-admin_port = 35357
36
+[policy]
37
+driver = keystone.policy.backends.simple.SimpleMatch
46 38
 
47
-# SSL for API Admin server
48
-admin_ssl = False
39
+[ec2]
40
+driver = keystone.contrib.ec2.backends.sql.Ec2
49 41
 
50
-# Keystone certificate file (modify as needed)
51
-# Only required if *_ssl is set to True
52
-certfile = /etc/keystone/ssl/certs/keystone.pem
42
+[filter:debug]
43
+paste.filter_factory = keystone.common.wsgi:Debug.factory
53 44
 
54
-# Keystone private key file (modify as needed)
55
-# Only required if *_ssl is set to True
56
-keyfile = /etc/keystone/ssl/private/keystonekey.pem
45
+[filter:token_auth]
46
+paste.filter_factory = keystone.middleware:TokenAuthMiddleware.factory
57 47
 
58
-# Keystone trusted CA certificates  (modify as needed)
59
-# Only required if *_ssl is set to True
60
-ca_certs = /etc/keystone/ssl/certs/ca.pem
48
+[filter:admin_token_auth]
49
+paste.filter_factory = keystone.middleware:AdminTokenAuthMiddleware.factory
61 50
 
62
-# Client certificate required
63
-# Only relevant if *_ssl is set to True
64
-cert_required = True
51
+[filter:json_body]
52
+paste.filter_factory = keystone.middleware:JsonBodyMiddleware.factory
65 53
 
66
-#Role that allows to perform admin operations.
67
-keystone_admin_role = admin
54
+[filter:crud_extension]
55
+paste.filter_factory = keystone.contrib.admin_crud:CrudExtension.factory
68 56
 
69
-#Role that allows to perform service admin operations.
70
-keystone_service_admin_role = KeystoneServiceAdmin
57
+[filter:ec2_extension]
58
+paste.filter_factory = keystone.contrib.ec2:Ec2Extension.factory
71 59
 
72
-#Tells whether password user need to be hashed in the backend
73
-hash_password = True
60
+[app:public_service]
61
+paste.app_factory = keystone.service:public_app_factory
74 62
 
75
-[keystone.backends.sqlalchemy]
76
-# SQLAlchemy connection string for the reference implementation registry
77
-# server. Any valid SQLAlchemy connection string is fine.
78
-# See: http://bit.ly/ideIpI
79
-sql_connection = %SQL_CONN%
80
-backend_entities = ['UserRoleAssociation', 'Endpoints', 'Role', 'Tenant',
81
-                    'User', 'Credentials', 'EndpointTemplates', 'Token',
82
-                    'Service']
63
+[app:admin_service]
64
+paste.app_factory = keystone.service:admin_app_factory
83 65
 
84
-# Period in seconds after which SQLAlchemy should reestablish its connection
85
-# to the database.
86
-sql_idle_timeout = 30
66
+[pipeline:public_api]
67
+pipeline = token_auth admin_token_auth json_body debug ec2_extension public_service
87 68
 
88
-[pipeline:admin]
89
-pipeline =
90
-    urlrewritefilter
91
-    admin_api
69
+[pipeline:admin_api]
70
+pipeline = token_auth admin_token_auth json_body debug ec2_extension crud_extension admin_service
92 71
 
93
-[pipeline:keystone-legacy-auth]
94
-pipeline =
95
-    urlrewritefilter
96
-    legacy_auth
97
-    service_api
72
+[app:public_version_service]
73
+paste.app_factory = keystone.service:public_version_app_factory
98 74
 
99
-[app:service_api]
100
-paste.app_factory = keystone.server:service_app_factory
75
+[app:admin_version_service]
76
+paste.app_factory = keystone.service:admin_version_app_factory
101 77
 
102
-[app:admin_api]
103
-paste.app_factory = keystone.server:admin_app_factory
78
+[pipeline:public_version_api]
79
+pipeline = public_version_service
104 80
 
105
-[filter:urlrewritefilter]
106
-paste.filter_factory = keystone.middleware.url:filter_factory
81
+[pipeline:admin_version_api]
82
+pipeline = admin_version_service
107 83
 
108
-[filter:legacy_auth]
109
-paste.filter_factory = keystone.frontends.legacy_token_auth:filter_factory
84
+[composite:main]
85
+use = egg:Paste#urlmap
86
+/v2.0 = public_api
87
+/ = public_version_api
110 88
 
111
-[filter:debug]
112
-paste.filter_factory = keystone.common.wsgi:debug_filter_factory
89
+[composite:admin]
90
+use = egg:Paste#urlmap
91
+/v2.0 = admin_api
92
+/ = admin_version_service
... ...
@@ -1,54 +1,91 @@
1 1
 #!/bin/bash
2
-BIN_DIR=${BIN_DIR:-.}
3 2
 # Tenants
4
-$BIN_DIR/keystone-manage tenant add admin
5
-$BIN_DIR/keystone-manage tenant add demo
6
-$BIN_DIR/keystone-manage tenant add invisible_to_admin
3
+export SERVICE_TOKEN=$SERVICE_TOKEN
4
+export SERVICE_ENDPOINT=$SERVICE_ENDPOINT
5
+
6
+function get_id () {
7
+    echo `$@ | grep id | awk '{print $4}'`
8
+}
9
+
10
+ADMIN_TENANT=`get_id keystone tenant-create --name=admin`
11
+DEMO_TENANT=`get_id keystone tenant-create --name=demo`
12
+INVIS_TENANT=`get_id keystone tenant-create --name=invisible_to_admin`
13
+
7 14
 
8 15
 # Users
9
-$BIN_DIR/keystone-manage user add admin %ADMIN_PASSWORD%
10
-$BIN_DIR/keystone-manage user add demo %ADMIN_PASSWORD%
16
+ADMIN_USER=`get_id keystone user-create \
17
+                                 --name=admin \
18
+                                 --pass="$ADMIN_PASSWORD" \
19
+                                 --email=admin@example.com`
20
+DEMO_USER=`get_id keystone user-create \
21
+                                 --name=demo \
22
+                                 --pass="$ADMIN_PASSWORD" \
23
+                                 --email=admin@example.com`
11 24
 
12 25
 # Roles
13
-$BIN_DIR/keystone-manage role add admin
14
-$BIN_DIR/keystone-manage role add Member
15
-$BIN_DIR/keystone-manage role add KeystoneAdmin
16
-$BIN_DIR/keystone-manage role add KeystoneServiceAdmin
17
-$BIN_DIR/keystone-manage role add sysadmin
18
-$BIN_DIR/keystone-manage role add netadmin
19
-$BIN_DIR/keystone-manage role grant admin admin admin
20
-$BIN_DIR/keystone-manage role grant Member demo demo
21
-$BIN_DIR/keystone-manage role grant sysadmin demo demo
22
-$BIN_DIR/keystone-manage role grant netadmin demo demo
23
-$BIN_DIR/keystone-manage role grant Member demo invisible_to_admin
24
-$BIN_DIR/keystone-manage role grant admin admin demo
25
-$BIN_DIR/keystone-manage role grant admin admin
26
-$BIN_DIR/keystone-manage role grant KeystoneAdmin admin
27
-$BIN_DIR/keystone-manage role grant KeystoneServiceAdmin admin
26
+ADMIN_ROLE=`get_id keystone role-create --name=admin`
27
+MEMBER_ROLE=`get_id keystone role-create --name=Member`
28
+KEYSTONEADMIN_ROLE=`get_id keystone role-create --name=KeystoneAdmin`
29
+KEYSTONESERVICE_ROLE=`get_id keystone role-create --name=KeystoneServiceAdmin`
30
+SYSADMIN_ROLE=`get_id keystone role-create --name=sysadmin`
31
+NETADMIN_ROLE=`get_id keystone role-create --name=netadmin`
32
+
33
+
34
+# Add Roles to Users in Tenants
35
+
36
+keystone add-user-role $ADMIN_USER $ADMIN_ROLE $ADMIN_TENANT
37
+keystone add-user-role $DEMO_USER $MEMBER_ROLE $DEMO_TENANT
38
+keystone add-user-role $DEMO_USER $SYSADMIN_ROLE $DEMO_TENANT
39
+keystone add-user-role $DEMO_USER $NETADMIN_ROLE $DEMO_TENANT
40
+keystone add-user-role $DEMO_USER $MEMBER_ROLE $INVIS_TENANT
41
+keystone add-user-role $ADMIN_USER $ADMIN_ROLE $DEMO_TENANT
42
+
43
+# TODO(termie): these two might be dubious
44
+keystone add-user-role $ADMIN_USER $KEYSTONEADMIN_ROLE $ADMIN_TENANT
45
+keystone add-user-role $ADMIN_USER $KEYSTONESERVICE_ROLE $ADMIN_TENANT
28 46
 
29 47
 # Services
30
-$BIN_DIR/keystone-manage service add nova compute "Nova Compute Service"
31
-$BIN_DIR/keystone-manage service add ec2 ec2 "EC2 Compatability Layer"
32
-$BIN_DIR/keystone-manage service add glance image "Glance Image Service"
33
-$BIN_DIR/keystone-manage service add keystone identity "Keystone Identity Service"
34
-if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
35
-    $BIN_DIR/keystone-manage service add swift object-store "Swift Service"
36
-fi
48
+keystone service-create \
49
+                                 --name=nova \
50
+                                 --type=compute \
51
+                                 --description="Nova Compute Service"
52
+
53
+keystone service-create \
54
+                                 --name=ec2 \
55
+                                 --type=ec2 \
56
+                                 --description="EC2 Compatibility Layer"
37 57
 
38
-#endpointTemplates
39
-$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne nova http://%SERVICE_HOST%:8774/v1.1/%tenant_id% http://%SERVICE_HOST%:8774/v1.1/%tenant_id%  http://%SERVICE_HOST%:8774/v1.1/%tenant_id% 1 1
40
-$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne ec2 http://%SERVICE_HOST%:8773/services/Cloud http://%SERVICE_HOST%:8773/services/Admin http://%SERVICE_HOST%:8773/services/Cloud 1 1
41
-$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne glance http://%SERVICE_HOST%:9292/v1 http://%SERVICE_HOST%:9292/v1 http://%SERVICE_HOST%:9292/v1 1 1
42
-$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne keystone %KEYSTONE_SERVICE_PROTOCOL%://%KEYSTONE_SERVICE_HOST%:%KEYSTONE_SERVICE_PORT%/v2.0 %KEYSTONE_AUTH_PROTOCOL%://%KEYSTONE_AUTH_HOST%:%KEYSTONE_AUTH_PORT%/v2.0 %KEYSTONE_SERVICE_PROTOCOL%://%KEYSTONE_SERVICE_HOST%:%KEYSTONE_SERVICE_PORT%/v2.0 1 1
58
+keystone service-create \
59
+                                 --name=glance \
60
+                                 --type=image \
61
+                                 --description="Glance Image Service"
62
+
63
+keystone service-create \
64
+                                 --name=keystone \
65
+                                 --type=identity \
66
+                                 --description="Keystone Identity Service"
43 67
 if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
44
-    $BIN_DIR/keystone-manage $* endpointTemplates add RegionOne swift http://%SERVICE_HOST%:8080/v1/AUTH_%tenant_id% http://%SERVICE_HOST%:8080/ http://%SERVICE_HOST%:8080/v1/AUTH_%tenant_id% 1 1
68
+    keystone service-create \
69
+                                 --name=swift \
70
+                                 --type="object-store" \
71
+                                 --description="Swift Service"
45 72
 fi
46 73
 
47
-# Tokens
48
-$BIN_DIR/keystone-manage token add %SERVICE_TOKEN% admin admin 2015-02-05T00:00
74
+# create ec2 creds and parse the secret and access key returned
75
+RESULT=`keystone ec2-create-credentials --tenant_id=$ADMIN_TENANT --user_id=$ADMIN_USER`
76
+    echo `$@ | grep id | awk '{print $4}'`
77
+ADMIN_ACCESS=`echo "$RESULT" | grep access | awk '{print $4}'`
78
+ADMIN_SECRET=`echo "$RESULT" | grep secret | awk '{print $4}'`
79
+
80
+
81
+RESULT=`keystone ec2-create-credentials --tenant_id=$DEMO_TENANT --user_id=$DEMO_USER`
82
+DEMO_ACCESS=`echo "$RESULT" | grep access | awk '{print $4}'`
83
+DEMO_SECRET=`echo "$RESULT" | grep secret | awk '{print $4}'`
49 84
 
50
-# EC2 related creds - note we are setting the secret key to ADMIN_PASSWORD
51
-# but keystone doesn't parse them - it is just a blob from keystone's
52
-# point of view
53
-$BIN_DIR/keystone-manage credentials add admin EC2 'admin' '%ADMIN_PASSWORD%' admin || echo "no support for adding credentials"
54
-$BIN_DIR/keystone-manage credentials add demo EC2 'demo' '%ADMIN_PASSWORD%' demo || echo "no support for adding credentials"
85
+# write the secret and access to ec2rc
86
+cat > $DEVSTACK_DIR/ec2rc <<EOF
87
+ADMIN_ACCESS=$ADMIN_ACCESS
88
+ADMIN_SECRET=$ADMIN_SECRET
89
+DEMO_ACCESS=$DEMO_ACCESS
90
+DEMO_SECRET=$DEMO_SECRET
91
+EOF
... ...
@@ -1 +1,2 @@
1 1
 PassLib
2
+pycli
... ...
@@ -42,7 +42,7 @@ export OS_PASSWORD=${NOVA_PASSWORD}
42 42
 #
43 43
 # *NOTE*: Using the 2.0 *auth api* does not mean that compute api is 2.0.  We
44 44
 # will use the 1.1 *compute api*
45
-export NOVA_URL=${NOVA_URL:-http://$SERVICE_HOST:5000/v2.0/}
45
+export NOVA_URL=${NOVA_URL:-http://$SERVICE_HOST:5000/v2.0}
46 46
 export OS_AUTH_URL=${NOVA_URL}
47 47
 
48 48
 # Currently novaclient needs you to specify the *compute api* version.  This
... ...
@@ -56,10 +56,10 @@ export NOVA_REGION_NAME=${NOVA_REGION_NAME:-RegionOne}
56 56
 export EC2_URL=${EC2_URL:-http://$SERVICE_HOST:8773/services/Cloud}
57 57
 
58 58
 # Access key is set in the initial keystone data to be the same as username
59
-export EC2_ACCESS_KEY=${USERNAME:-demo}
59
+export EC2_ACCESS_KEY=${DEMO_ACCESS}
60 60
 
61 61
 # Secret key is set in the initial keystone data to the admin password
62
-export EC2_SECRET_KEY=${ADMIN_PASSWORD:-secrete}
62
+export EC2_SECRET_KEY=${DEMO_SECRET}
63 63
 
64 64
 # Euca2ools Certificate stuff for uploading bundles
65 65
 # You can get your certs using ./tools/get_certs.sh
... ...
@@ -533,6 +533,7 @@ pip_install `cat $FILES/pips/* | uniq`
533 533
 # compute service
534 534
 git_clone $NOVA_REPO $NOVA_DIR $NOVA_BRANCH
535 535
 # python client library to nova that horizon (and others) use
536
+git_clone $KEYSTONECLIENT_REPO $KEYSTONECLIENT_DIR $KEYSTONECLIENT_BRANCH
536 537
 git_clone $NOVACLIENT_REPO $NOVACLIENT_DIR $NOVACLIENT_BRANCH
537 538
 
538 539
 # glance, swift middleware and nova api needs keystone middleware
... ...
@@ -561,7 +562,6 @@ fi
561 561
 if [[ "$ENABLED_SERVICES" =~ "horizon" ]]; then
562 562
     # django powered web control panel for openstack
563 563
     git_clone $HORIZON_REPO $HORIZON_DIR $HORIZON_BRANCH $HORIZON_TAG
564
-    git_clone $KEYSTONECLIENT_REPO $KEYSTONECLIENT_DIR $KEYSTONECLIENT_BRANCH
565 564
 fi
566 565
 if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
567 566
     # quantum
... ...
@@ -584,6 +584,8 @@ fi
584 584
 
585 585
 # setup our checkouts so they are installed into python path
586 586
 # allowing ``import nova`` or ``import glance.client``
587
+cd $KEYSTONECLIENT_DIR; sudo python setup.py develop
588
+cd $NOVACLIENT_DIR; sudo python setup.py develop
587 589
 if [[ "$ENABLED_SERVICES" =~ "key" ||
588 590
       "$ENABLED_SERVICES" =~ "g-api" ||
589 591
       "$ENABLED_SERVICES" =~ "n-api" ||
... ...
@@ -598,10 +600,8 @@ if [[ "$ENABLED_SERVICES" =~ "g-api" ||
598 598
       "$ENABLED_SERVICES" =~ "n-api" ]]; then
599 599
     cd $GLANCE_DIR; sudo python setup.py develop
600 600
 fi
601
-cd $NOVACLIENT_DIR; sudo python setup.py develop
602 601
 cd $NOVA_DIR; sudo python setup.py develop
603 602
 if [[ "$ENABLED_SERVICES" =~ "horizon" ]]; then
604
-    cd $KEYSTONECLIENT_DIR; sudo python setup.py develop
605 603
     cd $HORIZON_DIR/horizon; sudo python setup.py develop
606 604
     cd $HORIZON_DIR/openstack-dashboard; sudo python setup.py develop
607 605
 fi
... ...
@@ -793,28 +793,20 @@ fi
793 793
 
794 794
 # Nova
795 795
 # ----
796
-
797
-# Put config files in /etc/nova for everyone to find
798
-NOVA_CONF=/etc/nova
799
-if [[ ! -d $NOVA_CONF ]]; then
800
-    sudo mkdir -p $NOVA_CONF
801
-fi
802
-sudo chown `whoami` $NOVA_CONF
803
-
804 796
 if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
805 797
     # We are going to use a sample http middleware configuration based on the
806 798
     # one from the keystone project to launch nova.  This paste config adds
807 799
     # the configuration required for nova to validate keystone tokens.
808 800
 
809 801
     # First we add a some extra data to the default paste config from nova
810
-    cp $NOVA_DIR/etc/nova/api-paste.ini $NOVA_CONF
802
+    cp $NOVA_DIR/etc/nova/api-paste.ini $NOVA_DIR/bin/nova-api-paste.ini
811 803
 
812 804
     # Then we add our own service token to the configuration
813
-    sed -e "s,%SERVICE_TOKEN%,$SERVICE_TOKEN,g" -i $NOVA_CONF/api-paste.ini
805
+    sed -e "s,%SERVICE_TOKEN%,$SERVICE_TOKEN,g" -i $NOVA_DIR/bin/nova-api-paste.ini
814 806
 
815 807
     # Finally, we change the pipelines in nova to use keystone
816 808
     function replace_pipeline() {
817
-        sed "/\[pipeline:$1\]/,/\[/s/^pipeline = .*/pipeline = $2/" -i $NOVA_CONF/api-paste.ini
809
+        sed "/\[pipeline:$1\]/,/\[/s/^pipeline = .*/pipeline = $2/" -i $NOVA_DIR/bin/nova-api-paste.ini
818 810
     }
819 811
     replace_pipeline "ec2cloud" "ec2faultwrap logrequest totoken authtoken keystonecontext cloudrequest authorizer validator ec2executor"
820 812
     replace_pipeline "ec2admin" "ec2faultwrap logrequest totoken authtoken keystonecontext adminrequest authorizer ec2executor"
... ...
@@ -1101,11 +1093,11 @@ if [[ "$ENABLED_SERVICES" =~ "n-vol" ]]; then
1101 1101
 fi
1102 1102
 
1103 1103
 function add_nova_flag {
1104
-    echo "$1" >> $NOVA_CONF/nova.conf
1104
+    echo "$1" >> $NOVA_DIR/bin/nova.conf
1105 1105
 }
1106 1106
 
1107 1107
 # (re)create nova.conf
1108
-rm -f $NOVA_CONF/nova.conf
1108
+rm -f $NOVA_DIR/bin/nova.conf
1109 1109
 add_nova_flag "--verbose"
1110 1110
 add_nova_flag "--allow_admin_api"
1111 1111
 add_nova_flag "--scheduler_driver=$SCHEDULER"
... ...
@@ -1165,7 +1157,7 @@ fi
1165 1165
 VNCSERVER_LISTEN=${VNCSERVER_LISTEN=127.0.0.1}
1166 1166
 add_nova_flag "--vncserver_listen=$VNCSERVER_LISTEN"
1167 1167
 add_nova_flag "--vncserver_proxyclient_address=$VNCSERVER_PROXYCLIENT_ADDRESS"
1168
-add_nova_flag "--api_paste_config=$NOVA_CONF/api-paste.ini"
1168
+add_nova_flag "--api_paste_config=$NOVA_DIR/bin/nova-api-paste.ini"
1169 1169
 add_nova_flag "--image_service=nova.image.glance.GlanceImageService"
1170 1170
 add_nova_flag "--ec2_dmz_host=$EC2_DMZ_HOST"
1171 1171
 add_nova_flag "--rabbit_host=$RABBIT_HOST"
... ...
@@ -1231,51 +1223,6 @@ if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
1231 1231
 fi
1232 1232
 
1233 1233
 
1234
-# Keystone
1235
-# --------
1236
-
1237
-if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
1238
-    # (re)create keystone database
1239
-    mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS keystone;'
1240
-    mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE keystone;'
1241
-
1242
-    # Configure keystone.conf
1243
-    KEYSTONE_CONF=$KEYSTONE_DIR/etc/keystone.conf
1244
-    cp $FILES/keystone.conf $KEYSTONE_CONF
1245
-    sudo sed -e "s,%SQL_CONN%,$BASE_SQL_CONN/keystone,g" -i $KEYSTONE_CONF
1246
-    sudo sed -e "s,%DEST%,$DEST,g" -i $KEYSTONE_CONF
1247
-
1248
-    # keystone_data.sh creates our admin user and our ``SERVICE_TOKEN``.
1249
-    KEYSTONE_DATA=$KEYSTONE_DIR/bin/keystone_data.sh
1250
-    cp $FILES/keystone_data.sh $KEYSTONE_DATA
1251
-    sudo sed -e "
1252
-        s,%KEYSTONE_AUTH_HOST%,$KEYSTONE_AUTH_HOST,g;
1253
-        s,%KEYSTONE_AUTH_PORT%,$KEYSTONE_AUTH_PORT,g;
1254
-        s,%KEYSTONE_AUTH_PROTOCOL%,$KEYSTONE_AUTH_PROTOCOL,g;
1255
-        s,%KEYSTONE_SERVICE_HOST%,$KEYSTONE_SERVICE_HOST,g;
1256
-        s,%KEYSTONE_SERVICE_PORT%,$KEYSTONE_SERVICE_PORT,g;
1257
-        s,%KEYSTONE_SERVICE_PROTOCOL%,$KEYSTONE_SERVICE_PROTOCOL,g;
1258
-        s,%SERVICE_HOST%,$SERVICE_HOST,g;
1259
-        s,%SERVICE_TOKEN%,$SERVICE_TOKEN,g;
1260
-        s,%ADMIN_PASSWORD%,$ADMIN_PASSWORD,g;
1261
-    " -i $KEYSTONE_DATA
1262
-
1263
-    # Prepare up the database
1264
-    $KEYSTONE_DIR/bin/keystone-manage sync_database
1265
-
1266
-    # initialize keystone with default users/endpoints
1267
-    ENABLED_SERVICES=$ENABLED_SERVICES BIN_DIR=$KEYSTONE_DIR/bin bash $KEYSTONE_DATA
1268
-
1269
-    if [ "$SYSLOG" != "False" ]; then
1270
-        sed -i -e '/^handlers=devel$/s/=devel/=production/' \
1271
-            $KEYSTONE_DIR/etc/logging.cnf
1272
-        sed -i -e "/^log_file/s/log_file/\#log_file/" \
1273
-            $KEYSTONE_DIR/etc/keystone.conf
1274
-        KEYSTONE_LOG_CONFIG="--log-config $KEYSTONE_DIR/etc/logging.cnf"
1275
-    fi
1276
-fi
1277
-
1278
-
1279 1234
 # Launch Services
1280 1235
 # ===============
1281 1236
 
... ...
@@ -1317,16 +1264,54 @@ if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then
1317 1317
     fi
1318 1318
 fi
1319 1319
 
1320
+if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
1321
+    # (re)create keystone database
1322
+    mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS keystone;'
1323
+    mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE keystone;'
1324
+
1325
+    # Configure keystone.conf
1326
+    KEYSTONE_CONF=$KEYSTONE_DIR/etc/keystone.conf
1327
+    cp $FILES/keystone.conf $KEYSTONE_CONF
1328
+    sudo sed -e "s,%SQL_CONN%,$BASE_SQL_CONN/keystone,g" -i $KEYSTONE_CONF
1329
+    sudo sed -e "s,%DEST%,$DEST,g" -i $KEYSTONE_CONF
1330
+    sudo sed -e "s,%SERVICE_TOKEN%,$SERVICE_TOKEN,g" -i $KEYSTONE_CONF
1331
+    sudo sed -e "s,%KEYSTONE_DIR%,$KEYSTONE_DIR,g" -i $KEYSTONE_CONF
1332
+
1333
+    KEYSTONE_CATALOG=$KEYSTONE_DIR/etc/default_catalog.templates
1334
+    cp $FILES/default_catalog.templates $KEYSTONE_CATALOG
1335
+    sudo sed -e "s,%SERVICE_HOST%,$SERVICE_HOST,g" -i $KEYSTONE_CATALOG
1336
+
1337
+
1338
+    if [ "$SYSLOG" != "False" ]; then
1339
+        cp $KEYSTONE_DIR/etc/logging.conf.sample $KEYSTONE_DIR/etc/logging.conf
1340
+        sed -i -e '/^handlers=devel$/s/=devel/=production/' \
1341
+            $KEYSTONE_DIR/etc/logging.conf
1342
+        sed -i -e "/^log_file/s/log_file/\#log_file/" \
1343
+            $KEYSTONE_DIR/etc/keystone.conf
1344
+        KEYSTONE_LOG_CONFIG="--log-config $KEYSTONE_DIR/etc/logging.conf"
1345
+    fi
1346
+fi
1347
+
1320 1348
 # launch the keystone and wait for it to answer before continuing
1321 1349
 if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
1322
-    screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone --config-file $KEYSTONE_CONF $KEYSTONE_LOG_CONFIG -d"
1350
+    screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone-all --config-file $KEYSTONE_CONF $KEYSTONE_LOG_CONFIG -d --debug"
1323 1351
     echo "Waiting for keystone to start..."
1324
-    if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT; do sleep 1; done"; then
1352
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0/; do sleep 1; done"; then
1325 1353
       echo "keystone did not start"
1326 1354
       exit 1
1327 1355
     fi
1356
+
1357
+    # initialize keystone with default users/endpoints
1358
+    pushd $KEYSTONE_DIR
1359
+    $KEYSTONE_DIR/bin/keystone-manage db_sync
1360
+    popd
1361
+
1362
+    # keystone_data.sh creates services, admin and demo users, and roles.
1363
+    SERVICE_ENDPOINT=$KEYSTONE_AUTH_PROTOCOL://$KEYSTONE_AUTH_HOST:$KEYSTONE_AUTH_PORT/v2.0
1364
+    ADMIN_PASSWORD=$ADMIN_PASSWORD SERVICE_TOKEN=$SERVICE_TOKEN SERVICE_ENDPOINT=$SERVICE_ENDPOINT DEVSTACK_DIR=$TOP_DIR ENABLED_SERVICES=$ENABLED_SERVICES bash $FILES/keystone_data.sh
1328 1365
 fi
1329 1366
 
1367
+
1330 1368
 # launch the nova-api and wait for it to answer before continuing
1331 1369
 if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
1332 1370
     screen_it n-api "cd $NOVA_DIR && $NOVA_DIR/bin/nova-api"
... ...
@@ -1459,6 +1444,10 @@ if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then
1459 1459
     # Create a directory for the downloaded image tarballs.
1460 1460
     mkdir -p $FILES/images
1461 1461
 
1462
+    ADMIN_USER=admin
1463
+    ADMIN_TENANT=admin
1464
+    TOKEN=`curl -s -d  "{\"auth\":{\"passwordCredentials\": {\"username\": \"$ADMIN_USER\", \"password\": \"$ADMIN_PASSWORD\"}, \"tenantName\": \"$ADMIN_TENANT\"}}" -H "Content-type: application/json" http://$HOST_IP:5000/v2.0/tokens | python -c "import sys; import json; tok = json.loads(sys.stdin.read()); print tok['access']['token']['id'];"`
1465
+
1462 1466
     # Option to upload legacy ami-tty, which works with xenserver
1463 1467
     if [ $UPLOAD_LEGACY_TTY ]; then
1464 1468
         if [ ! -f $FILES/tty.tgz ]; then
... ...
@@ -1466,11 +1455,11 @@ if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then
1466 1466
         fi
1467 1467
 
1468 1468
         tar -zxf $FILES/tty.tgz -C $FILES/images
1469
-        RVAL=`glance add -A $SERVICE_TOKEN name="tty-kernel" is_public=true container_format=aki disk_format=aki < $FILES/images/aki-tty/image`
1469
+        RVAL=`glance add -A $TOKEN name="tty-kernel" is_public=true container_format=aki disk_format=aki < $FILES/images/aki-tty/image`
1470 1470
         KERNEL_ID=`echo $RVAL | cut -d":" -f2 | tr -d " "`
1471
-        RVAL=`glance add -A $SERVICE_TOKEN name="tty-ramdisk" is_public=true container_format=ari disk_format=ari < $FILES/images/ari-tty/image`
1471
+        RVAL=`glance add -A $TOKEN name="tty-ramdisk" is_public=true container_format=ari disk_format=ari < $FILES/images/ari-tty/image`
1472 1472
         RAMDISK_ID=`echo $RVAL | cut -d":" -f2 | tr -d " "`
1473
-        glance add -A $SERVICE_TOKEN name="tty" is_public=true container_format=ami disk_format=ami kernel_id=$KERNEL_ID ramdisk_id=$RAMDISK_ID < $FILES/images/ami-tty/image
1473
+        glance add -A $TOKEN name="tty" is_public=true container_format=ami disk_format=ami kernel_id=$KERNEL_ID ramdisk_id=$RAMDISK_ID < $FILES/images/ami-tty/image
1474 1474
     fi
1475 1475
 
1476 1476
     for image_url in ${IMAGE_URLS//,/ }; do
... ...
@@ -1517,14 +1506,14 @@ if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then
1517 1517
         # kernel for use when uploading the root filesystem.
1518 1518
         KERNEL_ID=""; RAMDISK_ID="";
1519 1519
         if [ -n "$KERNEL" ]; then
1520
-            RVAL=`glance add -A $SERVICE_TOKEN name="$IMAGE_NAME-kernel" is_public=true container_format=aki disk_format=aki < "$KERNEL"`
1520
+            RVAL=`glance add -A $TOKEN name="$IMAGE_NAME-kernel" is_public=true container_format=aki disk_format=aki < "$KERNEL"`
1521 1521
             KERNEL_ID=`echo $RVAL | cut -d":" -f2 | tr -d " "`
1522 1522
         fi
1523 1523
         if [ -n "$RAMDISK" ]; then
1524
-            RVAL=`glance add -A $SERVICE_TOKEN name="$IMAGE_NAME-ramdisk" is_public=true container_format=ari disk_format=ari < "$RAMDISK"`
1524
+            RVAL=`glance add -A $TOKEN name="$IMAGE_NAME-ramdisk" is_public=true container_format=ari disk_format=ari < "$RAMDISK"`
1525 1525
             RAMDISK_ID=`echo $RVAL | cut -d":" -f2 | tr -d " "`
1526 1526
         fi
1527
-        glance add -A $SERVICE_TOKEN name="${IMAGE_NAME%.img}" is_public=true container_format=ami disk_format=ami ${KERNEL_ID:+kernel_id=$KERNEL_ID} ${RAMDISK_ID:+ramdisk_id=$RAMDISK_ID} < <(zcat --force "${IMAGE}")
1527
+        glance add -A $TOKEN name="${IMAGE_NAME%.img}" is_public=true container_format=ami disk_format=ami ${KERNEL_ID:+kernel_id=$KERNEL_ID} ${RAMDISK_ID:+ramdisk_id=$RAMDISK_ID} < <(zcat --force "${IMAGE}")
1528 1528
     done
1529 1529
 fi
1530 1530
 
... ...
@@ -16,7 +16,7 @@ GLANCE_BRANCH=master
16 16
 
17 17
 # unified auth system (manages accounts/tokens)
18 18
 KEYSTONE_REPO=https://github.com/openstack/keystone.git
19
-KEYSTONE_BRANCH=master
19
+KEYSTONE_BRANCH=redux
20 20
 
21 21
 # a websockets/html5 or flash powered VNC console for vm instances
22 22
 NOVNC_REPO=https://github.com/cloudbuilders/noVNC.git
... ...
@@ -76,6 +76,11 @@ case "$LIBVIRT_TYPE" in
76 76
         IMAGE_URLS="http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-uec.tar.gz";;
77 77
 esac
78 78
 
79
+# use stored ec2 env variables
80
+if [ -f ./ec2rc ]; then
81
+    source ./ec2rc
82
+fi
83
+
79 84
 # allow local overrides of env variables
80 85
 if [ -f ./localrc ]; then
81 86
     source ./localrc