Browse code

Disable swift3 by default.

- Disable swift3 by default but add a new service `swift3` to enable it.
- Fixes bug 1021150.

Change-Id: I6b635008659e1a77fdfce364dfceaca593273c54

Chmouel Boudjnah authored on 2012/07/05 15:50:51
Showing 2 changed files
... ...
@@ -69,7 +69,7 @@ If you want a minimal Swift install with only Swift and Keystone you can have th
69 69
 
70 70
 If you use Swift with Keystone, Swift will authenticate against it. You will need to make sure to use the Keystone URL to auth against.
71 71
 
72
-Swift will be acting as a S3 endpoint for Keystone so effectively replacing the `nova-objectstore`.
72
+If you are enabling `swift3` in `ENABLED_SERVICES` devstack will install the swift3 middleware emulation. Swift will be configured to act as a S3 endpoint for Keystone so effectively replacing the `nova-objectstore`.
73 73
 
74 74
 Only Swift proxy server is launched in the screen session all other services are started in background and managed by `swift-init` tool.
75 75
 
... ...
@@ -499,9 +499,11 @@ SWIFT_PARTITION_POWER_SIZE=${SWIFT_PARTITION_POWER_SIZE:-9}
499 499
 SWIFT_REPLICAS=${SWIFT_REPLICAS:-3}
500 500
 
501 501
 if is_service_enabled swift; then
502
-    # If we are using swift, we can default the s3 port to swift instead
502
+    # If we are using swift3, we can default the s3 port to swift instead
503 503
     # of nova-objectstore
504
-    S3_SERVICE_PORT=${S3_SERVICE_PORT:-8080}
504
+    if is_service_enabled swift3;then
505
+        S3_SERVICE_PORT=${S3_SERVICE_PORT:-8080}
506
+    fi
505 507
     # We only ask for Swift Hash if we have enabled swift service.
506 508
     # SWIFT_HASH is a random unique string for a swift cluster that
507 509
     # can never change.
... ...
@@ -642,8 +644,10 @@ if is_service_enabled swift; then
642 642
     git_clone $SWIFT_REPO $SWIFT_DIR $SWIFT_BRANCH
643 643
     # storage service client and and Library
644 644
     git_clone $SWIFTCLIENT_REPO $SWIFTCLIENT_DIR $SWIFTCLIENT_BRANCH
645
-    # swift3 middleware to provide S3 emulation to Swift
646
-    git_clone $SWIFT3_REPO $SWIFT3_DIR $SWIFT3_BRANCH
645
+    if is_service_enabled swift3; then
646
+        # swift3 middleware to provide S3 emulation to Swift
647
+        git_clone $SWIFT3_REPO $SWIFT3_DIR $SWIFT3_BRANCH
648
+    fi
647 649
 fi
648 650
 if is_service_enabled g-api n-api; then
649 651
     # image catalog service
... ...
@@ -1449,11 +1453,15 @@ if is_service_enabled swift; then
1449 1449
         sudo sed -i '/disable *= *yes/ { s/yes/no/ }' /etc/xinetd.d/rsync
1450 1450
     fi
1451 1451
 
1452
+    if is_service_enabled swift3;then
1453
+        swift_auth_server="s3token "
1454
+    fi
1455
+        
1452 1456
     # By default Swift will be installed with the tempauth middleware
1453 1457
     # which has some default username and password if you have
1454 1458
     # configured keystone it will checkout the directory.
1455 1459
     if is_service_enabled key; then
1456
-        swift_auth_server="s3token authtoken keystone"
1460
+        swift_auth_server+="authtoken keystone"
1457 1461
     else
1458 1462
         swift_auth_server=tempauth
1459 1463
     fi
... ...
@@ -1476,7 +1484,10 @@ if is_service_enabled swift; then
1476 1476
     iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT bind_port
1477 1477
     iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT bind_port ${SWIFT_DEFAULT_BIND_PORT:-8080}
1478 1478
 
1479
-    iniset ${SWIFT_CONFIG_PROXY_SERVER} pipeline:main pipeline "catch_errors healthcheck cache ratelimit swift3 ${swift_auth_server} proxy-logging proxy-server"
1479
+    # Only enable Swift3 if we have it enabled in ENABLED_SERVICES
1480
+    is_service_enabled swift3 && swift3=swift3 || swift3=""
1481
+
1482
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} pipeline:main pipeline "catch_errors healthcheck cache ratelimit ${swift3} ${swift_auth_server} proxy-logging proxy-server"
1480 1483
 
1481 1484
     iniset ${SWIFT_CONFIG_PROXY_SERVER} app:proxy-server account_autocreate true
1482 1485
 
... ...
@@ -1486,16 +1497,6 @@ if is_service_enabled swift; then
1486 1486
 paste.filter_factory = keystone.middleware.swift_auth:filter_factory
1487 1487
 operator_roles = Member,admin
1488 1488
 
1489
-# NOTE(chmou): s3token middleware is not updated yet to use only
1490
-# username and password.
1491
-[filter:s3token]
1492
-paste.filter_factory = keystone.middleware.s3_token:filter_factory
1493
-auth_port = ${KEYSTONE_AUTH_PORT}
1494
-auth_host = ${KEYSTONE_AUTH_HOST}
1495
-auth_protocol = ${KEYSTONE_AUTH_PROTOCOL}
1496
-auth_token = ${SERVICE_TOKEN}
1497
-admin_token = ${SERVICE_TOKEN}
1498
-
1499 1489
 [filter:authtoken]
1500 1490
 paste.filter_factory = keystone.middleware.auth_token:filter_factory
1501 1491
 auth_host = ${KEYSTONE_AUTH_HOST}
... ...
@@ -1505,10 +1506,23 @@ auth_uri = ${KEYSTONE_SERVICE_PROTOCOL}://${KEYSTONE_SERVICE_HOST}:${KEYSTONE_SE
1505 1505
 admin_tenant_name = ${SERVICE_TENANT_NAME}
1506 1506
 admin_user = swift
1507 1507
 admin_password = ${SERVICE_PASSWORD}
1508
+EOF
1509
+    if is_service_enabled swift3;then
1510
+        cat <<EOF>>${SWIFT_CONFIG_PROXY_SERVER}
1511
+# NOTE(chmou): s3token middleware is not updated yet to use only
1512
+# username and password.
1513
+[filter:s3token]
1514
+paste.filter_factory = keystone.middleware.s3_token:filter_factory
1515
+auth_port = ${KEYSTONE_AUTH_PORT}
1516
+auth_host = ${KEYSTONE_AUTH_HOST}
1517
+auth_protocol = ${KEYSTONE_AUTH_PROTOCOL}
1518
+auth_token = ${SERVICE_TOKEN}
1519
+admin_token = ${SERVICE_TOKEN}
1508 1520
 
1509 1521
 [filter:swift3]
1510 1522
 use = egg:swift3#swift3
1511 1523
 EOF
1524
+    fi
1512 1525
 
1513 1526
     cp ${SWIFT_DIR}/etc/swift.conf-sample ${SWIFT_CONFIG_DIR}/swift.conf
1514 1527
     iniset ${SWIFT_CONFIG_DIR}/swift.conf swift-hash swift_hash_path_suffix ${SWIFT_HASH}
... ...
@@ -1957,7 +1971,7 @@ if is_service_enabled key; then
1957 1957
     export OS_PASSWORD=$ADMIN_PASSWORD
1958 1958
 
1959 1959
     # Create an access key and secret key for nova ec2 register image
1960
-    if is_service_enabled swift && is_service_enabled nova; then
1960
+    if is_service_enabled swift3 && is_service_enabled nova; then
1961 1961
         NOVA_USER_ID=$(keystone user-list | grep ' nova ' | get_field 1)
1962 1962
         NOVA_TENANT_ID=$(keystone tenant-list | grep " $SERVICE_TENANT_NAME " | get_field 1)
1963 1963
         CREDS=$(keystone ec2-credentials-create --user_id $NOVA_USER_ID --tenant_id $NOVA_TENANT_ID)
... ...
@@ -2013,9 +2027,9 @@ fi
2013 2013
 screen_it horizon "cd $HORIZON_DIR && sudo tail -f /var/log/$APACHE_NAME/horizon_error.log"
2014 2014
 screen_it swift "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONFIG_DIR}/proxy-server.conf -v"
2015 2015
 
2016
-# Starting the nova-objectstore only if swift service is not enabled.
2016
+# Starting the nova-objectstore only if swift3 service is not enabled.
2017 2017
 # Swift will act as s3 objectstore.
2018
-is_service_enabled swift || \
2018
+is_service_enabled swift3 || \
2019 2019
     screen_it n-obj "cd $NOVA_DIR && $NOVA_DIR/bin/nova-objectstore"
2020 2020
 
2021 2021