Commit b1fb7cf7 authored by Stavros Sachtouris's avatar Stavros Sachtouris

Delete servers even when they have networks

parent 6a2f35f4
...@@ -231,11 +231,13 @@ function_map = { ...@@ -231,11 +231,13 @@ function_map = {
'get_flavor': snf_get_flavor, 'get_flavor': snf_get_flavor,
'get_images': snf_get_images, 'get_images': snf_get_images,
'get_image': snf_get_image, 'get_image': snf_get_image,
'get_floating_ip_pools': empty_list_200,
'get_server_volumes_link': snf_get_server_volumes_link, 'get_server_volumes_link': snf_get_server_volumes_link,
'_get_ports': snf_get_server_net_attachments, '_get_ports': snf_get_server_net_attachments,
'delete': snf_delete_server, 'delete': snf_delete_server,
'create_server': snf_create_server, 'create_server': snf_create_server,
'run_action': snf_run_action, 'run_action': snf_run_action,
'keypair_create': keypair_register 'keypair_create': keypair_register,
# TODO: Implement these when you do networks
'get_floating_ips': empty_list_200, # Helps in server delete
'get_floating_ip_pools': empty_list_200,
} }
...@@ -89,7 +89,7 @@ echo ...@@ -89,7 +89,7 @@ echo
echo "Create a server instance" echo "Create a server instance"
echo "Meaning: kamaki server create --name \"OCCI test VM\" \\" echo "Meaning: kamaki server create --name \"OCCI test VM\" \\"
echo " --flavor-id <ID of c2r2048d40drb> --image-id <ID of ${OS_TPL}>" echo " --flavor-id ${RESOURCE_TPL} --image-id ${OS_TPL}"
CMD="${BASE_CMD} --action create --resource compute " CMD="${BASE_CMD} --action create --resource compute "
CMD="${CMD} --attribute occi.core.title=\"OCCI test VM\"" CMD="${CMD} --attribute occi.core.title=\"OCCI test VM\""
CMD="${CMD} --mixin os_tpl#${OS_TPL} --mixin resource_tpl#${RESOURCE_TPL}" CMD="${CMD} --mixin os_tpl#${OS_TPL} --mixin resource_tpl#${RESOURCE_TPL}"
...@@ -174,16 +174,8 @@ else ...@@ -174,16 +174,8 @@ else
eval $ACMD eval $ACMD
echo echo
WAIT=5; sleep 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 "Server state is $STATE"
WAIT=5; WAIT=5;
while [ $STATE != 'active' ] while [ $STATE != 'active' ]
do do
...@@ -198,9 +190,9 @@ else ...@@ -198,9 +190,9 @@ else
echo "Destroy server instance ${SUFFIX}"; echo "Destroy server instance ${SUFFIX}";
echo "Meaning: kamaki server delete ${SERVER_URL}"; echo "Meaning: kamaki server delete ${SERVER_URL}";
CMD="${BASE_CMD} --action delete --resource ${SUFFIX}"; ACMD="${BASE_CMD} --action delete --resource ${SUFFIX}";
echo "$CMD"; echo "$ACMD";
eval $CMD; eval $ACMD;
WAIT=5; WAIT=5;
while [ $STATE == 'active' ] while [ $STATE == 'active' ]
...@@ -236,7 +228,7 @@ echo ...@@ -236,7 +228,7 @@ echo
echo "Create a server instance with PPK" echo "Create a server instance with PPK"
echo "Meaning: kamaki server create --name \"OCCI test VM\" \\" echo "Meaning: kamaki server create --name \"OCCI test VM\" \\"
echo " --flavor-id ${RESOURCE_TPL} --image-id ${OS_TPL} \\" 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"
CMD="${BASE_CMD} --action create --resource compute" CMD="${BASE_CMD} --action create --resource compute"
CMD="${CMD} --attribute occi.core.title=\"OCCI test VM\"" CMD="${CMD} --attribute occi.core.title=\"OCCI test VM\""
CMD="${CMD} --mixin os_tpl#${OS_TPL} --mixin resource_tpl#${RESOURCE_TPL}" CMD="${CMD} --mixin os_tpl#${OS_TPL} --mixin resource_tpl#${RESOURCE_TPL}"
......
...@@ -17,7 +17,7 @@ from ooi.wsgi import OCCIMiddleware ...@@ -17,7 +17,7 @@ from ooi.wsgi import OCCIMiddleware
from ooi.api.helpers import OpenStackHelper from ooi.api.helpers import OpenStackHelper
from soi.config import KEYSTONE_URL from soi.config import KEYSTONE_URL
from soi.synnefo import AstakosClient, AUTH_URL from soi.synnefo import AstakosClient, AUTH_URL
from soi import utils, compute, storage, storage_link from soi import utils, compute, storage, storage_link, network
from kamaki.clients import ClientError from kamaki.clients import ClientError
......
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