Browse code

Merge branch 'fix_cache' into lessapt

Conflicts:
tools/build_libvirt.sh

Anthony Young authored on 2011/11/04 08:31:20
Showing 15 changed files
... ...
@@ -192,21 +192,23 @@ nova secgroup-delete $SECGROUP
192 192
 # make sure that we can describe instances
193 193
 euca-describe-instances
194 194
 
195
-# Testing Swift
196
-# =============
195
+if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
196
+    # Testing Swift
197
+    # =============
197 198
 
198
-# Check if we have to swift via keystone
199
-swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD stat
199
+    # Check if we have to swift via keystone
200
+    swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD stat
200 201
 
201
-# We start by creating a test container
202
-swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD post testcontainer
202
+    # We start by creating a test container
203
+    swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD post testcontainer
203 204
 
204
-# add some files into it.
205
-swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD upload testcontainer /etc/issue
205
+    # add some files into it.
206
+    swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD upload testcontainer /etc/issue
206 207
 
207
-# list them
208
-swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD list testcontainer 
208
+    # list them
209
+    swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD list testcontainer 
209 210
 
210
-# And we may want to delete them now that we have tested that
211
-# everything works.
212
-swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD delete testcontainer
211
+    # And we may want to delete them now that we have tested that
212
+    # everything works.
213
+    swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD delete testcontainer
214
+fi
... ...
@@ -2,7 +2,7 @@ dnsmasq-base
2 2
 kpartx
3 3
 parted
4 4
 arping # used for send_arp_for_ha option in nova-network
5
-mysql-server
5
+mysql-server # NOPRIME
6 6
 python-mysqldb
7 7
 kvm
8 8
 gawk
... ...
@@ -11,10 +11,10 @@ ebtables
11 11
 sqlite3
12 12
 sudo
13 13
 kvm
14
-libvirt-bin
14
+libvirt-bin # NOPRIME
15 15
 vlan
16 16
 curl
17
-rabbitmq-server
17
+rabbitmq-server # NOPRIME
18 18
 socat # used by ajaxterm
19 19
 python-mox
20 20
 python-paste
... ...
@@ -1,6 +1,6 @@
1 1
 curl
2 2
 gcc
3
-memcached
3
+memcached # NOPRIME
4 4
 python-configobj
5 5
 python-coverage
6 6
 python-dev
... ...
@@ -4,6 +4,7 @@ mount_check = false
4 4
 bind_port = %BIND_PORT%
5 5
 user = %USER%
6 6
 log_facility = LOG_LOCAL%LOG_FACILITY%
7
+swift_dir = %SWIFT_CONFIG_LOCATION%
7 8
 
8 9
 [pipeline:main]
9 10
 pipeline = account-server
... ...
@@ -4,6 +4,7 @@ mount_check = false
4 4
 bind_port = %BIND_PORT%
5 5
 user = %USER%
6 6
 log_facility = LOG_LOCAL%LOG_FACILITY%
7
+swift_dir = %SWIFT_CONFIG_LOCATION%
7 8
 
8 9
 [pipeline:main]
9 10
 pipeline = container-server
... ...
@@ -4,6 +4,7 @@ mount_check = false
4 4
 bind_port = %BIND_PORT%
5 5
 user = %USER%
6 6
 log_facility = LOG_LOCAL%LOG_FACILITY%
7
+swift_dir = %SWIFT_CONFIG_LOCATION%
7 8
 
8 9
 [pipeline:main]
9 10
 pipeline = object-server
... ...
@@ -2,6 +2,7 @@
2 2
 bind_port = 8080
3 3
 user = %USER%
4 4
 log_facility = LOG_LOCAL1
5
+swift_dir = %SWIFT_CONFIG_LOCATION%
5 6
 
6 7
 [pipeline:main]
7 8
 pipeline = healthcheck cache %AUTH_SERVER% proxy-server
... ...
@@ -6,74 +6,74 @@ address = 127.0.0.1
6 6
 
7 7
 [account6012]
8 8
 max connections = 25
9
-path = %SWIFT_LOCATION%/1/node/
9
+path = %SWIFT_DATA_LOCATION%/1/node/
10 10
 read only = false
11 11
 lock file = /var/lock/account6012.lock
12 12
 
13 13
 [account6022]
14 14
 max connections = 25
15
-path = %SWIFT_LOCATION%/2/node/
15
+path = %SWIFT_DATA_LOCATION%/2/node/
16 16
 read only = false
17 17
 lock file = /var/lock/account6022.lock
18 18
 
19 19
 [account6032]
20 20
 max connections = 25
21
-path = %SWIFT_LOCATION%/3/node/
21
+path = %SWIFT_DATA_LOCATION%/3/node/
22 22
 read only = false
23 23
 lock file = /var/lock/account6032.lock
24 24
 
25 25
 [account6042]
26 26
 max connections = 25
27
-path = %SWIFT_LOCATION%/4/node/
27
+path = %SWIFT_DATA_LOCATION%/4/node/
28 28
 read only = false
29 29
 lock file = /var/lock/account6042.lock
30 30
 
31 31
 
32 32
 [container6011]
33 33
 max connections = 25
34
-path = %SWIFT_LOCATION%/1/node/
34
+path = %SWIFT_DATA_LOCATION%/1/node/
35 35
 read only = false
36 36
 lock file = /var/lock/container6011.lock
37 37
 
38 38
 [container6021]
39 39
 max connections = 25
40
-path = %SWIFT_LOCATION%/2/node/
40
+path = %SWIFT_DATA_LOCATION%/2/node/
41 41
 read only = false
42 42
 lock file = /var/lock/container6021.lock
43 43
 
44 44
 [container6031]
45 45
 max connections = 25
46
-path = %SWIFT_LOCATION%/3/node/
46
+path = %SWIFT_DATA_LOCATION%/3/node/
47 47
 read only = false
48 48
 lock file = /var/lock/container6031.lock
49 49
 
50 50
 [container6041]
51 51
 max connections = 25
52
-path = %SWIFT_LOCATION%/4/node/
52
+path = %SWIFT_DATA_LOCATION%/4/node/
53 53
 read only = false
54 54
 lock file = /var/lock/container6041.lock
55 55
 
56 56
 
57 57
 [object6010]
58 58
 max connections = 25
59
-path = %SWIFT_LOCATION%/1/node/
59
+path = %SWIFT_DATA_LOCATION%/1/node/
60 60
 read only = false
61 61
 lock file = /var/lock/object6010.lock
62 62
 
63 63
 [object6020]
64 64
 max connections = 25
65
-path = %SWIFT_LOCATION%/2/node/
65
+path = %SWIFT_DATA_LOCATION%/2/node/
66 66
 read only = false
67 67
 lock file = /var/lock/object6020.lock
68 68
 
69 69
 [object6030]
70 70
 max connections = 25
71
-path = %SWIFT_LOCATION%/3/node/
71
+path = %SWIFT_DATA_LOCATION%/3/node/
72 72
 read only = false
73 73
 lock file = /var/lock/object6030.lock
74 74
 
75 75
 [object6040]
76 76
 max connections = 25
77
-path = %SWIFT_LOCATION%/4/node/
77
+path = %SWIFT_DATA_LOCATION%/4/node/
78 78
 read only = false
79 79
 lock file = /var/lock/object6040.lock
... ...
@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-cd /etc/swift
3
+cd %SWIFT_CONFIG_LOCATION%
4 4
 
5 5
 rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz
6 6
 
... ...
@@ -293,9 +293,13 @@ GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292}
293 293
 # TODO: add logging to different location.
294 294
 
295 295
 # By default the location of swift drives and objects is located inside
296
-# the swift source directory. SWIFT_LOCATION variable allow you to redefine
296
+# the swift source directory. SWIFT_DATA_LOCATION variable allow you to redefine
297 297
 # this.
298
-SWIFT_LOCATION=${SWIFT_LOCATION:-${SWIFT_DIR}/data}
298
+SWIFT_DATA_LOCATION=${SWIFT_DATA_LOCATION:-${SWIFT_DIR}/data}
299
+
300
+# We are going to have the configuration files inside the source
301
+# directory, change SWIFT_CONFIG_LOCATION if you want to adjust that.
302
+SWIFT_CONFIG_LOCATION=${SWIFT_CONFIG_LOCATION:-${SWIFT_DIR}/config}
299 303
 
300 304
 # devstack will create a loop-back disk formatted as XFS to store the
301 305
 # swift data. By default the disk size is 1 gigabyte. The variable
... ...
@@ -313,9 +317,13 @@ SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000}
313 313
 # By default we define 9 for the partition count (which mean 512).
314 314
 SWIFT_PARTITION_POWER_SIZE=${SWIFT_PARTITION_POWER_SIZE:-9}
315 315
 
316
-# SWIFT_HASH is a random unique string for a swift cluster that can never change.
317
-read_password SWIFT_HASH "ENTER A RANDOM SWIFT HASH."
318
-
316
+# We only ask for Swift Hash if we have enabled swift service.
317
+if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
318
+    # SWIFT_HASH is a random unique string for a swift cluster that
319
+    # can never change.
320
+    read_password SWIFT_HASH "ENTER A RANDOM SWIFT HASH."
321
+fi
322
+    
319 323
 # Keystone
320 324
 # --------
321 325
 
... ...
@@ -640,47 +648,54 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
640 640
     # changing the permissions so we can run it as our user.
641 641
 
642 642
     USER_GROUP=$(id -g)
643
-    sudo mkdir -p ${SWIFT_LOCATION}/drives
644
-    sudo chown -R $USER:${USER_GROUP} ${SWIFT_LOCATION}/drives
643
+    sudo mkdir -p ${SWIFT_DATA_LOCATION}/drives
644
+    sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_LOCATION}/drives
645 645
     
646 646
     # We then create a loopback disk and format it to XFS.
647
-    if [[ ! -e ${SWIFT_LOCATION}/drives/images/swift.img ]];then
648
-        mkdir -p  ${SWIFT_LOCATION}/drives/images
649
-        sudo touch  ${SWIFT_LOCATION}/drives/images/swift.img
650
-        sudo chown $USER: ${SWIFT_LOCATION}/drives/images/swift.img
647
+    if [[ ! -e ${SWIFT_DATA_LOCATION}/drives/images/swift.img ]];then
648
+        mkdir -p  ${SWIFT_DATA_LOCATION}/drives/images
649
+        sudo touch  ${SWIFT_DATA_LOCATION}/drives/images/swift.img
650
+        sudo chown $USER: ${SWIFT_DATA_LOCATION}/drives/images/swift.img
651 651
         
652
-        dd if=/dev/zero of=${SWIFT_LOCATION}/drives/images/swift.img \
652
+        dd if=/dev/zero of=${SWIFT_DATA_LOCATION}/drives/images/swift.img \
653 653
             bs=1024 count=0 seek=${SWIFT_LOOPBACK_DISK_SIZE}
654
-        mkfs.xfs -f -i size=1024  ${SWIFT_LOCATION}/drives/images/swift.img
654
+        mkfs.xfs -f -i size=1024  ${SWIFT_DATA_LOCATION}/drives/images/swift.img
655 655
     fi
656 656
 
657 657
     # After the drive being created we mount the disk with a few mount
658 658
     # options to make it most efficient as possible for swift.
659
-    mkdir -p ${SWIFT_LOCATION}/drives/sdb1
660
-    if ! egrep -q ${SWIFT_LOCATION}/drives/sdb1 /proc/mounts;then
659
+    mkdir -p ${SWIFT_DATA_LOCATION}/drives/sdb1
660
+    if ! egrep -q ${SWIFT_DATA_LOCATION}/drives/sdb1 /proc/mounts;then
661 661
         sudo mount -t xfs -o loop,noatime,nodiratime,nobarrier,logbufs=8  \
662
-            ${SWIFT_LOCATION}/drives/images/swift.img ${SWIFT_LOCATION}/drives/sdb1
662
+            ${SWIFT_DATA_LOCATION}/drives/images/swift.img ${SWIFT_DATA_LOCATION}/drives/sdb1
663 663
     fi
664 664
 
665 665
     # We then create link to that mounted location so swift would know
666 666
     # where to go.
667
-    for x in {1..4}; do sudo ln -sf ${SWIFT_LOCATION}/drives/sdb1/$x ${SWIFT_LOCATION}/$x; done
667
+    for x in {1..4}; do sudo ln -sf ${SWIFT_DATA_LOCATION}/drives/sdb1/$x ${SWIFT_DATA_LOCATION}/$x; done
668 668
     
669 669
     # We now have to emulate a few different servers into one we
670 670
     # create all the directories needed for swift 
671 671
     tmpd=""
672
-    for d in ${SWIFT_LOCATION}/drives/sdb1/{1..4} /etc/swift /etc/swift/{object,container,account}-server \
673
-        ${SWIFT_LOCATION}/{1..4}/node/sdb1 /var/run/swift ;do
672
+    for d in ${SWIFT_DATA_LOCATION}/drives/sdb1/{1..4} \
673
+        ${SWIFT_CONFIG_LOCATION}/{object,container,account}-server \
674
+        ${SWIFT_DATA_LOCATION}/{1..4}/node/sdb1 /var/run/swift ;do
674 675
         [[ -d $d ]] && continue
675 676
         sudo install -o ${USER} -g $USER_GROUP -d $d
676 677
     done
677 678
 
678
-    sudo chown -R $USER: ${SWIFT_LOCATION}/{1..4}/node
679
+   # We do want to make sure this is all owned by our user.
680
+   sudo chown -R $USER: ${SWIFT_DATA_LOCATION}/{1..4}/node
681
+   sudo chown -R $USER: ${SWIFT_CONFIG_LOCATION}
679 682
 
683
+   # swift-init has a bug using /etc/swift until bug #885595 is fixed
684
+   # we have to create a link
685
+   sudo ln -s ${SWIFT_CONFIG_LOCATION} /etc/swift
686
+   
680 687
    # Swift use rsync to syncronize between all the different
681 688
    # partitions (which make more sense when you have a multi-node
682 689
    # setup) we configure it with our version of rsync.
683
-   sed -e "s/%GROUP%/${USER_GROUP}/;s/%USER%/$USER/;s,%SWIFT_LOCATION%,$SWIFT_LOCATION," $FILES/swift/rsyncd.conf | sudo tee /etc/rsyncd.conf
690
+   sed -e "s/%GROUP%/${USER_GROUP}/;s/%USER%/$USER/;s,%SWIFT_DATA_LOCATION%,$SWIFT_DATA_LOCATION," $FILES/swift/rsyncd.conf | sudo tee /etc/rsyncd.conf
684 691
    sudo sed -i '/^RSYNC_ENABLE=false/ { s/false/true/ }' /etc/default/rsync
685 692
 
686 693
    # By default Swift will be installed with the tempauth middleware
... ...
@@ -699,10 +714,10 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
699 699
 
700 700
    # We do the install of the proxy-server and swift configuration
701 701
    # replacing a few directives to match our configuration.
702
-   sed "s/%USER%/$USER/;s/%SERVICE_TOKEN%/${SERVICE_TOKEN}/;s/%AUTH_SERVER%/${swift_auth_server}/" \
703
-       $FILES/swift/proxy-server.conf|sudo tee  /etc/swift/proxy-server.conf
702
+   sed "s,%SWIFT_CONFIG_LOCATION%,${SWIFT_CONFIG_LOCATION},;s/%USER%/$USER/;s/%SERVICE_TOKEN%/${SERVICE_TOKEN}/;s/%AUTH_SERVER%/${swift_auth_server}/" \
703
+       $FILES/swift/proxy-server.conf|sudo tee  ${SWIFT_CONFIG_LOCATION}/proxy-server.conf
704 704
 
705
-   sed -e "s/%SWIFT_HASH%/$SWIFT_HASH/" $FILES/swift/swift.conf > /etc/swift/swift.conf
705
+   sed -e "s/%SWIFT_HASH%/$SWIFT_HASH/" $FILES/swift/swift.conf > ${SWIFT_CONFIG_LOCATION}/swift.conf
706 706
 
707 707
    # We need to generate a object/account/proxy configuration
708 708
    # emulating 4 nodes on different ports we have a little function
... ...
@@ -714,9 +729,9 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
714 714
        local node_number
715 715
        
716 716
        for node_number in {1..4};do
717
-           node_path=${SWIFT_LOCATION}/${node_number}
718
-           sed -e "s,%USER%,$USER,;s,%NODE_PATH%,${node_path},;s,%BIND_PORT%,${bind_port},;s,%LOG_FACILITY%,${log_facility}," \
719
-               $FILES/swift/${server_type}-server.conf > /etc/swift/${server_type}-server/${node_number}.conf
717
+           node_path=${SWIFT_DATA_LOCATION}/${node_number}
718
+           sed -e "s,%SWIFT_CONFIG_LOCATION%,${SWIFT_CONFIG_LOCATION},;s,%USER%,$USER,;s,%NODE_PATH%,${node_path},;s,%BIND_PORT%,${bind_port},;s,%LOG_FACILITY%,${log_facility}," \
719
+               $FILES/swift/${server_type}-server.conf > ${SWIFT_CONFIG_LOCATION}/${server_type}-server/${node_number}.conf
720 720
            bind_port=$(( ${bind_port} + 10 ))
721 721
            log_facility=$(( ${log_facility} + 1 ))
722 722
        done
... ...
@@ -732,7 +747,7 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
732 732
    # - swift-startmain
733 733
    #   Restart your full cluster.
734 734
    #
735
-   sed -e "s/%SWIFT_PARTITION_POWER_SIZE%/$SWIFT_PARTITION_POWER_SIZE/" $FILES/swift/swift-remakerings | \
735
+   sed -e "s,%SWIFT_CONFIG_LOCATION%,${SWIFT_CONFIG_LOCATION},;s/%SWIFT_PARTITION_POWER_SIZE%/$SWIFT_PARTITION_POWER_SIZE/" $FILES/swift/swift-remakerings | \
736 736
        sudo tee /usr/local/bin/swift-remakerings
737 737
    sudo install -m755 $FILES/swift/swift-startmain /usr/local/bin/
738 738
    sudo chmod +x /usr/local/bin/swift-*
... ...
@@ -4,7 +4,7 @@ NOVA_BRANCH=diablo
4 4
 
5 5
 # storage service
6 6
 SWIFT_REPO=https://github.com/openstack/swift.git
7
-SWIFT_BRANCH=1.4.3
7
+SWIFT_BRANCH=stable/diablo
8 8
 
9 9
 # swift and keystone integration
10 10
 SWIFT_KEYSTONE_REPO=https://github.com/cloudbuilders/swift-keystone2.git
... ...
@@ -145,8 +145,9 @@ function git_clone {
145 145
 # Make sure that base requirements are installed
146 146
 cp /etc/resolv.conf $COPY_DIR/etc/resolv.conf
147 147
 chroot $COPY_DIR apt-get update
148
-chroot $COPY_DIR apt-get install -y --download-only `cat files/apts/* | cut -d\# -f1`
149
-chroot $COPY_DIR apt-get install -y --force-yes `cat files/apts/general`
148
+chroot $COPY_DIR apt-get install -y --download-only `cat files/apts/* | grep NOPRIME | cut -d\# -f1`
149
+chroot $COPY_DIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1`
150
+chroot $COPY_DIR pip install `cat files/pips/*`
150 151
 
151 152
 # Clean out code repos if directed to do so
152 153
 if [ "$CLEAN" = "1" ]; then
... ...
@@ -125,8 +125,8 @@ fi
125 125
 
126 126
 # Make sure that base requirements are installed
127 127
 chroot $CACHEDIR apt-get update
128
-chroot $CACHEDIR apt-get install -y --force-yes `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server|memcached)"`
129
-chroot $CACHEDIR apt-get install -y --download-only rabbitmq-server libvirt-bin mysql-server
128
+chroot $CACHEDIR apt-get install -y --download-only `cat files/apts/* | grep NOPRIME | cut -d\# -f1`
129
+chroot $CACHEDIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1`
130 130
 chroot $CACHEDIR pip install `cat files/pips/*`
131 131
 
132 132
 # Clean out code repos if directed to do so
... ...
@@ -32,8 +32,9 @@ fi
32 32
 # prime natty with as many apt/pips as we can
33 33
 if [ ! -d $CHROOTCACHE/natty-dev ]; then
34 34
     rsync -azH $CHROOTCACHE/natty-base/ $CHROOTCACHE/natty-dev/
35
-    chroot $CHROOTCACHE/natty-dev apt-get install -y `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"`
36
-    chroot $CHROOTCACHE/natty-dev pip install `cat files/pips/*`
35
+    chroot $CHROOTCACHE apt-get install -y --download-only `cat files/apts/* | grep NOPRIME | cut -d\# -f1`
36
+    chroot $CHROOTCACHE apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1`
37
+    chroot $CHROOTCACHE pip install `cat files/pips/*`
37 38
 
38 39
     # Create a stack user that is a member of the libvirtd group so that stack
39 40
     # is able to interact with libvirt.
... ...
@@ -113,7 +113,8 @@ if [ ! -r $DEV_FILE ]; then
113 113
     mount -t ext4 ${NBD}p1 $MNTDIR
114 114
     cp -p /etc/resolv.conf $MNTDIR/etc/resolv.conf
115 115
 
116
-    chroot $MNTDIR apt-get install -y `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"`
116
+    chroot $MNTDIR apt-get install -y --download-only `cat files/apts/* | grep NOPRIME | cut -d\# -f1`
117
+    chroot $MNTDIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1`
117 118
     chroot $MNTDIR pip install `cat files/pips/*`
118 119
 
119 120
     # Create a stack user that is a member of the libvirtd group so that stack