Commit 6a2f35f4 authored by Stavros Sachtouris's avatar Stavros Sachtouris

Create servers with "networks=None" as default

This bug was exposed while running updated functional tests
parent 024f4f6c
......@@ -171,6 +171,12 @@ def snf_create_server(cls, req, name, image, flavor, **kwargs):
body['personality'] = personality
body.update(kwargs)
if not body.get('networks', None):
body.pop('networks', None)
if not body.get('block_device_mapping_v2', None):
body.pop('block_device_mapping_v2', None)
req.environ['kwargs'] = dict(json_data=dict(server=body))
req.environ['service_type'] = 'compute'
req.environ['method_name'] = 'servers_post'
......
......@@ -82,7 +82,7 @@ echo
echo
STATE=(`awk '/occi.compute.state/{n=split($0,a,"\""); print a[2];}' ${VM_INFO}`)
WAIT=1
WAIT=10
while [ $STATE != 'active' ]
do
echo "Server state is ${STATE}, wait ${WAIT}\" and check again"
......@@ -106,7 +106,7 @@ echo "Check server state"
echo $CMD
eval $CMD
STATE=(`awk '/occi.compute.state/{n=split($0,a,"\""); print a[2];}' ${VM_INFO}`)
WAIT=1
WAIT=5
while [ $STATE != 'inactive' ]
do
echo "Server state is ${STATE}, wait ${WAIT}\" and check again"
......@@ -129,11 +129,10 @@ echo "Check server state"
echo $CMD
eval $CMD
STATE=(`awk '/occi.compute.state/{n=split($0,a,"\""); print a[2];}' ${VM_INFO}`)
WAIT=1
WAIT=5
while [ $STATE != 'active' ]
do
echo "Server state is ${STATE}"
echo "wait ${WAIT}\" and check again"
echo "Server state is ${STATE}, wait ${WAIT}\" and check again"
sleep $WAIT
let "WAIT++"
eval $CMD
......@@ -154,7 +153,7 @@ echo "Check server state"
echo $CMD
eval $CMD
STATE=(`awk '/occi.compute.state/{n=split($0,a,"\""); print a[2];}' ${VM_INFO}`)
WAIT=1
WAIT=5
while [ $STATE != 'inactive' ]
do
echo "Server state is ${STATE}, wait ${WAIT}\" and check again"
......@@ -164,7 +163,7 @@ do
STATE=(`awk '/occi.compute.state/{n=split($0,a,"\""); print a[2];}' ${VM_INFO}`)
done
echo
WAIT=1
WAIT=5
while [ $STATE != 'active' ]
do
echo "Server state is ${STATE}, wait ${WAIT}\" and check again"
......@@ -185,11 +184,28 @@ eval $CMD
echo
echo
echo "Wait server to be destroyed"
CMD="${BASE_CMD} ${VM_URL} > ${VM_INFO}"
echo $CMD
eval $CMD
STATE=(`awk '/occi.compute.state/{n=split($0,a,"\""); print a[2];}' ${VM_INFO}`)
WAIT=10
while [ $STATE == 'active' ]
do
echo "Server state is ${STATE}, wait ${WAIT}\" and check again"
sleep $WAIT
let "WAIT++"
eval $CMD
STATE=(`awk '/occi.compute.state/{n=split($0,a,"\""); print a[2];}' ${VM_INFO}`)
done
echo
echo "Test create with context (PPK auth)"
echo "Meaning: kamaki server create --name \"My Test VM\" \\"
echo " --flavor-id ${RESOURCE_TPL} --image-id ${OS_TPL}"
echo " -p (`pwd`)/id_rsa.pub,/root/.ssh/authorized_keys,root,root,0600"
echo " -p `pwd`/id_rsa.pub,/root/.ssh/authorized_keys,root,root,0600"
echo "Create a PPK pair:"
PPK_DIR="/tmp"
......@@ -204,6 +220,7 @@ echo $PUBLIC_KEY
echo
echo
CMD="${BASE_CMD} -X'POST' $OCCI_ENDPOINT/compute \
-H'Category: compute; scheme=\"http://schemas.ogf.org/occi/infrastructure#\"; class=\"kind\"' \
-H'Content-Type: text/occi' \
......@@ -215,6 +232,7 @@ CMD="${BASE_CMD} -X'POST' $OCCI_ENDPOINT/compute \
-H'X-OCCI-Attribute: org.openstack.credentials.publickey.data=\"${PUBLIC_KEY}\"'"
echo $CMD
VM_URL=$(eval $CMD)
echo $VM_URL
VM_URL=(`echo $VM_URL|awk '{print $2;}'`)
echo
echo
......@@ -226,7 +244,7 @@ echo $CMD
eval $CMD
STATE=(`awk '/occi.compute.state/{n=split($0,a,"\""); print a[2];}' ${VM_INFO}`)
WAIT=1
WAIT=10
while [ $STATE != 'active' ]
do
echo "Server state is ${STATE}, wait ${WAIT}\" and check again"
......@@ -253,7 +271,9 @@ echo
echo "Check PPK authentication"
VM_ID=(`echo ${VM_URL}|awk '/\//{n=split($0,a,"/"); print a[n]; }'`)
CMD="scp -o \"StrictHostKeyChecking no\" -i ${PPK_DIR}/${PPK} root@snf-${VM_ID}.vm.okeanos.grnet.gr:/root/.ssh/authorized_keys ${PPK_DIR}/${PPK}.downloaded"
CMD="scp -o \"StrictHostKeyChecking no\" -i ${PPK_DIR}/${PPK} \
root@snf-${VM_ID}.vm.okeanos.grnet.gr:/root/.ssh/authorized_keys \
${PPK_DIR}/${PPK}.downloaded"
echo $CMD
eval $CMD
if [ -f ${PPK_DIR}/${PPK}.downloaded ]; then
......@@ -264,14 +284,6 @@ fi
echo
echo
echo "List all volumes"
echo "Meaning: kamaki volume list"
CMD="${BASE_CMD} $OCCI_ENDPOINT/volume"
echo $CMD
eval $CMD
echo
echo
echo "Clean up"
CMD="${BASE_CMD} -X DELETE ${VM_URL}"
echo $CMD
......
......@@ -119,7 +119,7 @@ else
eval $CMD;
STATE=(`awk '/occi.compute.state/{n=split($0,a," = "); print a[2];}' ${VM_INFO}`)
WAIT=1;
WAIT=10;
while [ $STATE != 'active' ]
do
echo "Server state is ${STATE}, wait ${WAIT}\" and check again"
......@@ -136,7 +136,7 @@ else
ACMD="${BASE_CMD} --resource ${SUFFIX} --action trigger --trigger-action ${ACTION}"
echo "$ACMD"
eval $ACMD
WAIT=1;
WAIT=5;
while [ $STATE != 'inactive' ]
do
echo "Server state is ${STATE}, wait ${WAIT}\" and check again"
......@@ -154,7 +154,7 @@ else
ACMD="${BASE_CMD} --resource ${SUFFIX} --action trigger --trigger-action ${ACTION}"
echo "$ACMD"
eval $ACMD
WAIT=1;
WAIT=5;
while [ $STATE != 'active' ]
do
echo "Server state is ${STATE}, wait ${WAIT}\" and check again"
......@@ -174,11 +174,45 @@ else
eval $ACMD
echo
WAIT=5;
while [ $STATE == 'active' ]
do
echo "Server state is ${STATE}, wait ${WAIT}\" and check again"
sleep $WAIT;
let "WAIT++";
eval $CMD;
STATE=(`awk '/occi.compute.state/{n=split($0,a," = "); print a[2];}' ${VM_INFO}`);
done;
echo "Server state is $STATE"
WAIT=5;
while [ $STATE != 'active' ]
do
echo "Server state is ${STATE}, wait ${WAIT}\" and check again"
sleep $WAIT;
let "WAIT++";
eval $CMD;
STATE=(`awk '/occi.compute.state/{n=split($0,a," = "); print a[2];}' ${VM_INFO}`);
done;
echo "Server state is $STATE"
echo
echo "Destroy server instance ${SUFFIX}";
echo "Meaning: kamaki server delete ${SERVER_URL}";
CMD="${BASE_CMD} --action delete --resource ${SUFFIX}";
echo "$CMD";
eval $CMD;
WAIT=5;
while [ $STATE == 'active' ]
do
echo "Server state is ${STATE}, wait ${WAIT}\" and check again"
sleep $WAIT;
let "WAIT++";
eval $CMD;
STATE=(`awk '/occi.compute.state/{n=split($0,a," = "); print a[2];}' ${VM_INFO}`);
done;
echo "Server state is $STATE"
echo
fi;
echo
echo
......@@ -220,7 +254,7 @@ echo "$CMD";
eval $CMD;
STATE=(`awk '/occi.compute.state/{n=split($0,a," = "); print a[2];}' ${VM_INFO}`)
WAIT=1;
WAIT=10;
while [ $STATE != 'active' ]
do
echo "Server state is ${STATE}, wait ${WAIT}\" and check again"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment