Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rollback new user programs

modification to performance testing script
  • Loading branch information...
commit 874031efef232096f46c39e86bff8cb9430e0ec8 1 parent 0a3a164
BuzzTroll authored
View
72 cumulus/perf/run-many.sh
@@ -2,49 +2,45 @@
tm_file=$1
touch $tm_file
-c_count="32"
-f_sizes="512"
+c="64"
buck="s3://TestBucket$RANDOM"
s3cmd mb $buck
pwd_dir=`pwd`
-for s in $f_sizes
-do
- echo "doing file $s"
- fname=$s.data
- dd of=$fname if=/dev/urandom count=$s bs=1048576 2> /dev/null
- md5=`md5sum $fname | awk '{ print $1 }'`
- b64=`./sumconvert.py $md5`
-
- for c in $c_count
+
+s="512"
+echo "doing file $s"
+fname=$s.data
+dd of=$fname if=/dev/urandom count=$s bs=1048576 2> /dev/null
+md5=`md5sum $fname | awk '{ print $1 }'`
+b64=`./sumconvert.py $md5`
+
+ echo "doing $c clients at once"
+
+ rm -f cumulus_tests.*
+ # put them all at once
+ for ((cnt=1; cnt <= $c; cnt++))
+ do
+ tf=`mktemp $pwd_dir/cumulus_tests.XXXXXXXXXX`
+ echo $tf
+ /usr/bin/time -a -o $tf --format "put $s $c %e" s3cmd --add-header=content-md5:$b64 --force put $fname $buck/$fname &
+ done
+ wait
+ cat cumulus_tests.* >> $tm_file
+ rm -f cumulus_tests.*
+
+ for ((cnt=1; cnt <= $c; cnt++))
do
- echo "doing $c clients at once"
-
- rm -f cumulus_tests.*
- # put them all at once
- for ((cnt=1; cnt <= $c; cnt++))
- do
- tf=`mktemp $pwd_dir/cumulus_tests.XXXXXXXXXX`
- echo $tf
- /usr/bin/time -a -o $tf --format "put $s $c %e" s3cmd --add-header=content-md5:$b64 --force put $fname $buck/$fname &
- done
- wait
- cat cumulus_tests.* >> $tm_file
- rm -f cumulus_tests.*
-
- for ((cnt=1; cnt <= $c; cnt++))
- do
- tf=`mktemp $pwd_dir/cumulus_tests.XXXXXXXXXX`
- /usr/bin/time -a -o $tf --format "get $s $c %e" s3cmd --force get $buck/$fname $fname.back &
- done
- wait
- cat cumulus_tests.* >> $tm_file
- rm -f cumulus_tests.*
-
- s3cmd del $buck/$fname
+ tf=`mktemp $pwd_dir/cumulus_tests.XXXXXXXXXX`
+ /usr/bin/time -a -o $tf --format "get $s $c %e" s3cmd --force get $buck/$fname $fname.back &
done
- rm $fname
- rm $fname.back
-done
+ wait
+ cat cumulus_tests.* >> $tm_file
+ rm -f cumulus_tests.*
+
+ s3cmd del $buck/$fname
+rm $fname
+rm $fname.back
+
s3cmd -r rb $buck
cat $tm_file
View
3  home/bin/nimbus-new-user
@@ -19,5 +19,6 @@ export DJANGO_SETTINGS_MODULE
source $NIMBUS_HOME/cumulus/env.sh
source $NIMBUS_HOME/ve/bin/activate
cd $NIMBUS_HOME
-$PYTHON_EXE $NIMBUS_HOME/libexec/nimbus_new_user.py "$@"
+which python
+$NIMBUS_HOME/ve/bin/python $NIMBUS_HOME/libexec/nimbus_new_user.py "$@"
exit $?
View
31 home/libexec/nimbus_edit_user.py
@@ -167,6 +167,15 @@ def edit_user(o, db):
s3u = user.get_alias_by_friendly(o.emailaddr, pynimbusauthz.alias_type_s3)
# if there is a dn set it
+ if o.access_id != None:
+ if s3u == None:
+ raise CLIError('EUSER', "There is no s3 user for: %s" % (o.emailaddr))
+ s3u.set_name(o.access_id.strip())
+
+ if o.access_secret != None:
+ if s3u == None:
+ raise CLIError('EUSER', "There is no s3 user for: %s" % (o.emailaddr))
+ s3u.set_data(o.access_secret.strip())
if o.dn != None:
if dnu == None:
raise CLIError('EUSER', "There is x509 entry for: %s" % (o.emailaddr))
@@ -181,24 +190,18 @@ def edit_user(o, db):
raise CLIError('EUSER', "There is no authz group for user: %s" % (old_dn))
group_id = group.group_id
+ dnu.set_name(o.dn.strip())
+
remove_gridmap(old_dn)
add_gridmap(o)
- dnu.set_name(o.dn.strip())
-
- try:
+
+ try:
remove_member(groupauthz_dir, old_dn)
add_member(groupauthz_dir, o.dn, group_id)
- except Exception, ex:
- print "WARNING %s" % (ex)
-
- if o.access_id != None:
- if s3u == None:
- raise CLIError('EUSER', "There is no s3 user for: %s" % (o.emailaddr))
- s3u.set_name(o.access_id.strip())
- if o.access_secret != None:
- if s3u == None:
- raise CLIError('EUSER', "There is no s3 user for: %s" % (o.emailaddr))
- s3u.set_data(o.access_secret.strip())
+ except:
+ remove_gridmap(o.dn)
+ add_gridmap(old_dn)
+
db.commit()
# todo, reset options structure to report user
View
4 home/libexec/nimbus_new_user.py
@@ -244,6 +244,7 @@ def add_gridmap(o):
f.close()
def create_user(o, db):
+ added_gridmap = False
try:
# create canonical user
user = User.get_user_by_friendly(db, o.emailaddr)
@@ -272,6 +273,7 @@ def create_user(o, db):
ua2 = user.create_alias(o.dn, pynimbusauthz.alias_type_x509, o.emailaddr)
# add dn to gridmap
add_gridmap(o)
+ added_gridmap = True
cloud_props(o)
if o.web:
@@ -283,6 +285,8 @@ def create_user(o, db):
db.commit()
except Exception, ex1:
+ if added_gridmap:
+ remove_gridmap(o.dn)
db.rollback()
if DEBUG:
traceback.print_exc(file=sys.stdout)
Please sign in to comment.
Something went wrong with that request. Please try again.