Browse code

Add keystone support with swift.

Chmouel Boudjnah authored on 2011/11/02 03:32:23
Showing 4 changed files
... ...
@@ -30,12 +30,13 @@ $BIN_DIR/keystone-manage $* role grant KeystoneServiceAdmin admin
30 30
 $BIN_DIR/keystone-manage $* service add nova compute "Nova Compute Service"
31 31
 $BIN_DIR/keystone-manage $* service add glance image "Glance Image Service"
32 32
 $BIN_DIR/keystone-manage $* service add keystone identity "Keystone Identity Service"
33
+$BIN_DIR/keystone-manage $* service add swift object-store "Swift Service"
33 34
 
34 35
 #endpointTemplates
35 36
 $BIN_DIR/keystone-manage $* endpointTemplates add RegionOne nova http://%HOST_IP%:8774/v1.1/%tenant_id% http://%HOST_IP%:8774/v1.1/%tenant_id%  http://%HOST_IP%:8774/v1.1/%tenant_id% 1 1
36 37
 $BIN_DIR/keystone-manage $* endpointTemplates add RegionOne glance http://%HOST_IP%:9292/v1.1/%tenant_id% http://%HOST_IP%:9292/v1.1/%tenant_id% http://%HOST_IP%:9292/v1.1/%tenant_id% 1 1
37 38
 $BIN_DIR/keystone-manage $* endpointTemplates add RegionOne keystone http://%HOST_IP%:5000/v2.0 http://%HOST_IP%:35357/v2.0 http://%HOST_IP%:5000/v2.0 1 1
38
-# $BIN_DIR/keystone-manage $* endpointTemplates add RegionOne swift http://%HOST_IP%:8080/v1/AUTH_%tenant_id% http://%HOST_IP%:8080/ http://%HOST_IP%:8080/v1/AUTH_%tenant_id% 1 1
39
+$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne swift http://%HOST_IP%:8080/v1/AUTH_%tenant_id% http://%HOST_IP%:8080/ http://%HOST_IP%:8080/v1/AUTH_%tenant_id% 1 1
39 40
 
40 41
 # Tokens
41 42
 $BIN_DIR/keystone-manage $* token add %SERVICE_TOKEN% admin admin 2015-02-05T00:00
... ...
@@ -4,13 +4,18 @@ user = stack
4 4
 log_facility = LOG_LOCAL1
5 5
 
6 6
 [pipeline:main]
7
-pipeline = healthcheck cache tempauth proxy-server
7
+pipeline = healthcheck cache %AUTH_SERVER% proxy-server
8 8
 
9 9
 [app:proxy-server]
10 10
 use = egg:swift#proxy
11 11
 allow_account_management = true
12 12
 account_autocreate = true
13 13
 
14
+[filter:keystone]
15
+use = egg:swiftkeystone2#keystone2
16
+keystone_admin_token = %SERVICE_TOKEN%
17
+keystone_url = http://localhost:35357/v2.0
18
+
14 19
 [filter:tempauth]
15 20
 use = egg:swift#tempauth
16 21
 user_admin_admin = admin .admin .reseller_admin
... ...
@@ -151,6 +151,7 @@ NOVACLIENT_DIR=$DEST/python-novaclient
151 151
 OPENSTACKX_DIR=$DEST/openstackx
152 152
 NOVNC_DIR=$DEST/noVNC
153 153
 SWIFT_DIR=$DEST/swift
154
+SWIFT_KEYSTONE_DIR=$DEST/swift-keystone2
154 155
 
155 156
 # Specify which services to launch.  These generally correspond to screen tabs
156 157
 ENABLED_SERVICES=${ENABLED_SERVICES:-g-api,g-reg,key,n-api,n-cpu,n-net,n-sch,n-vnc,horizon,mysql,rabbit,swift}
... ...
@@ -363,6 +364,8 @@ function git_clone {
363 363
 git_clone $NOVA_REPO $NOVA_DIR $NOVA_BRANCH
364 364
 # storage service
365 365
 git_clone $SWIFT_REPO $SWIFT_DIR $SWIFT_BRANCH
366
+# swift + keystone middleware
367
+git_clone $SWIFT_KEYSTONE_REPO $SWIFT_KEYSTONE_DIR $SWIFT_KEYSTONE_BRANCH
366 368
 # image catalog service
367 369
 git_clone $GLANCE_REPO $GLANCE_DIR $GLANCE_BRANCH
368 370
 # unified auth system (manages accounts/tokens)
... ...
@@ -385,6 +388,7 @@ git_clone $OPENSTACKX_REPO $OPENSTACKX_DIR $OPENSTACKX_BRANCH
385 385
 # allowing ``import nova`` or ``import glance.client``
386 386
 cd $KEYSTONE_DIR; sudo python setup.py develop
387 387
 cd $SWIFT_DIR; sudo python setup.py develop
388
+cd $SWIFT_KEYSTONE_DIR; sudo python setup.py develop
388 389
 cd $GLANCE_DIR; sudo python setup.py develop
389 390
 cd $NOVACLIENT_DIR; sudo python setup.py develop
390 391
 cd $NOVA_DIR; sudo python setup.py develop
... ...
@@ -648,9 +652,18 @@ EOF
648 648
    # Add rsync file
649 649
    sed -e "s,%SWIFT_LOCATION%,$SWIFT_LOCATION," $FILES/swift-rsyncd.conf | sudo tee /etc/rsyncd.conf
650 650
    sudo sed -i '/^RSYNC_ENABLE=false/ { s/false/true/ }' /etc/default/rsync
651
-   
652
-   # Copy proxy-server configuration
653
-   cp $FILES/swift-proxy-server.conf /etc/swift/proxy-server.conf
651
+
652
+   if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
653
+       swift_auth_server=keystone
654
+       # Temporary until we get this integrated in swift.
655
+       sudo curl -s -o/usr/local/bin/swift \
656
+           'https://review.openstack.org/gitweb?p=openstack/swift.git;a=blob_plain;f=bin/swift;hb=48bfda6e2fdf3886c98bd15649887d54b9a2574e'
657
+   else
658
+       swift_auth_server=tempauth
659
+   fi
660
+
661
+   sed "s/%SERVICE_TOKEN%/${SERVICE_TOKEN}/;s/%AUTH_SERVER%/${swift_auth_server}/" \
662
+       $FILES/swift-proxy-server.conf|sudo tee  /etc/swift/proxy-server.conf
654 663
 
655 664
    # Generate swift.conf, we need to have the swift-hash being random
656 665
    # and unique.
... ...
@@ -664,6 +677,8 @@ EOF
664 664
        local server_type=$1
665 665
        local bind_port=$2
666 666
        local log_facility=$3
667
+       local node_number
668
+       
667 669
        for node_number in {1..4};do
668 670
            node_path=${SWIFT_LOCATION}/${node_number}
669 671
            sed -e "s,%NODE_PATH%,${node_path},;s,%BIND_PORT%,${bind_port},;s,%LOG_FACILITY%,${log_facility}," \
... ...
@@ -693,8 +708,7 @@ EOF
693 693
    
694 694
    # This should work (tempauth)
695 695
    # swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing stat
696
-   unset s swift_hasH
697
-   
696
+   unset s swift_hash swift_auth_server tmpd
698 697
 fi
699 698
 
700 699
 # Volume Service
... ...
@@ -976,6 +990,10 @@ if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
976 976
     echo "examples on using novaclient command line is in exercise.sh"
977 977
     echo "the default users are: admin and demo"
978 978
     echo "the password: $ADMIN_PASSWORD"
979
+    if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
980
+        echo "Swift: swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin:admin -K $ADMIN_PASSWORD stat"
981
+    fi
982
+
979 983
 fi
980 984
 
981 985
 # indicate how long this took to run (bash maintained variable 'SECONDS')
... ...
@@ -6,6 +6,10 @@ NOVA_BRANCH=diablo
6 6
 SWIFT_REPO=https://github.com/openstack/swift.git
7 7
 SWIFT_BRANCH=1.4.3
8 8
 
9
+# swift and keystone integration
10
+SWIFT_KEYSTONE_REPO=https://github.com/cloudbuilders/swift-keystone2.git
11
+SWIFT_KEYSTONE_BRANCH=master
12
+
9 13
 # image catalog service
10 14
 GLANCE_REPO=https://github.com/cloudbuilders/glance.git
11 15
 GLANCE_BRANCH=diablo