diff --git a/doc/source/cleanup.rst b/doc/source/cleanup.rst index f42add2..d5657aa 100644 --- a/doc/source/cleanup.rst +++ b/doc/source/cleanup.rst @@ -2,48 +2,59 @@ OpenStack Resources Cleanup =========================== -KloudBuster may exit with resources lingering in the cloud under test when there are uncaught exceptions or when the configuration file explicitly disables any resource cleanup upon exit (this option can be useful for debugging for example). +KloudBuster may exit with resources lingering in the cloud under test when there +are uncaught exceptions or when the configuration file explicitly disables any +resource cleanup upon exit (this option can be useful for debugging for +example). + +KloudBuster provides a time saving *force_cleanup* python script to cleanup +resources created by a previous KlousBuster run. This script can also be used to +cleanup OpenStack resources with a name matching a given regular expression. + +Resources in a given selection set are deleted along with their dependencies in +the correct order. For example to delete a router you need to delete first all +the interfaces before you can delete the router. To delete a volume you need to +first detach the volume (if attached) before it can be deleted. Furthermore, +some resource deletions require dependent resources to be actually deleted first +(which can tale more or less time) before they can succeed. A volume detach +command for example can take time and if you do not want long enough the volume +deletion will fail. -KloudBuster provides a time saving *force_cleanup* python script to cleanup resources created by a previous KlousBuster run. This script can also be used to cleanup OpenStack resources with a name matching a given regular expression. -Resources in a given selection set are deleted along with their dependencies in the correct order. For example to delete a router you need to delete first all the interfaces before you can delete the router. To delete a volume you need to first detach the volume (if attached) before it can be deleted. -Furthermore, some resource deletions require dependent resources to be actually deleted first (which can tale more or less time) before they can succeed. A volume detach command for example can take time and if you do not want long enough the volume deletion will fail. The script takes care of all these dependencies and timing considerations. -The current version of the script can delete the following resources with a name that matches a given regular expression: +The current version of the script can delete the following resources with a name +that matches a given regular expression: * Storage - - * volume (detach and delete) + * volumes (detach and delete) * Compute - * instances * flavors * key pairs * Network - * security groups * floating IPs * routers (including all associated interfaces) * networks * Keystone: - * users * tenants + How to Select Resources to Delete --------------------------------- Resource list (--file ) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -KloudBuster generates a cleanup log file when it exits without deleting all resources. +KloudBuster generates a cleanup log file when it exits without deleting all +resources. This file is a text file with 1 row per resource, where each row has +the following format>:: -This file is a text file with 1 row per resource, where each row has the following format>:: - - |||| Example of cleanup log file:: @@ -69,17 +80,22 @@ Example of cleanup log file:: tenants|KBc-T0|59d98fa36536490a8746c517b3ed7383 networks|KBc-T0-U-R0-N0|7047d34c-ad77-4453-8d69-5dd41b102159 - -If such file is provided to the cleanup script using the --file option, only the resources described in the file will be deleted. +If such file is provided to the cleanup script using the *--file* option, only +the resources described in the file will be deleted. Discoverty with Resource name filter (--filter ) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -If no cleanup log file is provided, resources are discovered from OpenStack and selected using a regular expression on the resource name (--filter ). -You can specify any valid python regular expression to select the resource by name. -If you do not specify a cleanup log file nor a filter, the script will discover all resources with a name starting with "KB" which is the prefix for all KloudBuster resources. +If no cleanup log file is provided, resources are discovered from OpenStack and +selected using a regular expression on the resource name (--filter ). You +can specify any valid python regular expression to select the resource by name. -Some examples (refer to the python regex documentation for a detailed description of regular expressions): +If you do not specify a cleanup log file nor a filter, the script will discover +all resources with a name starting with "KB" which is the prefix for all +KloudBuster resources. + +Some examples (refer to the python regex documentation for a detailed +description of regular expressions): +--------------------+-----------------------------------------------------------------+ | Regular expression | (default) any OpenStack resource with a name starting with "KB | @@ -90,213 +106,215 @@ Some examples (refer to the python regex documentation for a detailed descriptio +--------------------+-----------------------------------------------------------------+ | glance|neutron | any resource with a name starting with "glance" or "neutron" | +--------------------+-----------------------------------------------------------------+ - - .. warning:: - you can of course also specify '.\*' to list all resources but you probably do not want to delete all of them! + You can of course also specify '.\*' to list all resources but you probably + do not want to delete all of them! Credentials (RC) file (--rc ) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Specify the openrc file (downloaded from the Horizon API Access page) to provide the credentials to access OpenStack. -Alternatively you can also source that file from the shell before invoking the force_cleanup.py script. - +Specify the openrc file (downloaded from the Horizon API Access page) to provide +the credentials to access OpenStack. Alternatively you can also source that file +from the shell before invoking the force_cleanup.py script. + Dry Run (--dryrun) ^^^^^^^^^^^^^^^^^^ -The script also provides a dry run mode, meaning that you can just check what the script would do without actually deleting anything. +The script also provides a dry run mode, meaning that you can just check what +the script would do without actually deleting anything. Installation and Dependencies ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The script is available in the OpenStack KloudBuster repository under kloudbuster/force_cleanup.py -If you need to run the script outside of the usual KloudBuster installation, the script requires the usual OpenStack python client libraries and requires credentials.py (from the kloudbuster module). Otherwise, pick one of the kloudbuster installation method to install the script. +The script is available in the OpenStack KloudBuster repository under +kloudbuster/force_cleanup.py. If you need to run the script outside of the usual +KloudBuster installation, the script requires the usual OpenStack python client +libraries and credentials.py (from the kloudbuster module). Otherwise, pick one +of the kloudbuster installation method to install the script. + Examples -------- KloudBuster resources cleanup:: - $ python force_cleanup.py -r admin-oper.sh - Please enter your OpenStack Password: - Discovering Storage resources... - Discovering Compute resources... - Discovering Network resources... - Discovering Keystone resources... - - - SELECTED RESOURCES: - +------------+--------------------+--------------------------------------+ - | Type | Name | UUID | - |------------+--------------------+--------------------------------------| - | volumes | KBc-T0-U-R0-N0-V34 | 8a7746b1-5c31-4db8-b80e-58baeb21b2e9 | - | volumes | KBc-T0-U-R0-N0-V36 | b1f007e6-e46f-4b25-beca-8418f8680377 | - | volumes | KBc-T0-U-R0-N0-V4 | 5168c8fb-2124-4c00-9365-0767551a1861 | - | volumes | KBc-T0-U-R0-N0-V3 | d02dd62b-cd12-4e75-8356-cf41f3d3bc86 | - | volumes | KBc-T0-U-R0-N0-V7 | 32f50b20-3d8c-46f8-8e0e-1e642fe52a67 | - | volumes | KBc-T0-U-R0-N0-V5 | 4ee5710f-8cb6-454d-8661-ac5daa0dec35 | - | volumes | KBc-T0-U-R0-N0-V31 | 5eae2777-6680-4d63-907f-9b9280bdab36 | - | volumes | KBc-T0-U-R0-N0-V17 | cd44d985-468c-4d15-a26a-3205966f56bf | - | volumes | KBc-T0-U-R0-N0-V29 | 20cfd301-6f24-4727-a2e6-ec4c7979f24a | - | volumes | KBc-T0-U-R0-N0-V9 | ab7a09cd-4176-4119-89bb-44f22e42ac57 | - | volumes | KBc-T0-U-R0-N0-V1 | 467c6203-b30a-460d-9654-79e3798814ad | - | volumes | KBc-T0-U-R0-N0-V13 | 9b8c1697-a691-4ca8-b8aa-0ba5126f4330 | - | volumes | KBc-T0-U-R0-N0-V20 | 2fae40bd-b7f8-4ad0-8b49-28199cc20219 | - | volumes | KBc-T0-U-R0-N0-V33 | 29949338-9fb0-4a6f-8df5-65a97cfc5b5c | - | volumes | KBc-T0-U-R0-N0-V10 | 562a7f29-e0d4-479d-a916-deb7b062d826 | - | volumes | KBc-T0-U-R0-N0-V35 | 9643b353-ac1b-4088-940d-babdfed8239a | - | volumes | KBc-T0-U-R0-N0-V25 | 1d605aed-ad92-469a-a3ae-d8763793b764 | - | volumes | KBc-T0-U-R0-N0-V22 | 895ba475-debb-4b06-9372-dabebfd26b1c | - | volumes | KBc-T0-U-R0-N0-V6 | f0c3659a-b9ef-4b15-a015-35fc845a8509 | - | volumes | KBc-T0-U-R0-N0-V37 | df749f20-f2a9-4d8e-b1c5-667c3c64bf15 | - | volumes | KBc-T0-U-R0-N0-V32 | 5cca56d7-9543-470e-a964-1f6a314ee3a7 | - | volumes | KBc-T0-U-R0-N0-V0 | eb4e82d7-131e-417a-9bbb-0aedbd3c2263 | - | volumes | KBc-T0-U-R0-N0-V38 | 65737d70-c41d-4a3d-853e-ae4c9ecae44d | - | volumes | KBc-T0-U-R0-N0-V23 | 04c5bcdb-49b5-4006-9479-1f15b530cfcc | - | volumes | KBc-T0-U-R0-N0-V11 | 181c2dc4-56fd-4f42-ab5d-5e9f9b8a3be5 | - | volumes | KBc-T0-U-R0-N0-V18 | 6f78f429-6603-4dba-9fa0-cbc601c170a1 | - | volumes | KBc-T0-U-R0-N0-V39 | b9878b28-9a34-43b0-a5ea-46f7598b23f7 | - | volumes | KBc-T0-U-R0-N0-V19 | 1a2ef52a-a990-4cb8-974e-2e7bfde07e64 | - | volumes | KBc-T0-U-R0-N0-V12 | 78761313-89d0-47df-b8a6-6d6baac5a48d | - | volumes | KBc-T0-U-R0-N0-V8 | 712c06bb-75a1-4d3b-8e7e-1d1845e2636e | - | volumes | KBc-T0-U-R0-N0-V30 | baaffd6c-ed0c-41c8-9f81-a59e8cef8318 | - | volumes | KBc-T0-U-R0-N0-V21 | 4ef6e3fd-e102-45f2-b69f-cc28049667b4 | - | volumes | KBc-T0-U-R0-N0-V28 | 728edd5d-df01-4eae-8811-1e8e0c1357d6 | - | volumes | KBc-T0-U-R0-N0-V14 | 33fe1128-a4da-4d68-b3fe-e160856c2b46 | - | volumes | KBc-T0-U-R0-N0-V15 | 7fac9831-2ade-487f-9c79-126b5981df5a | - | volumes | KBc-T0-U-R0-N0-V26 | 801f95d4-1100-4bbd-9ec1-5fbe925b70d5 | - | volumes | KBc-T0-U-R0-N0-V27 | 61802296-9201-4d7a-aeda-62f2ad8b2de2 | - | volumes | KBc-T0-U-R0-N0-V24 | 9fab9127-a496-41ad-b8ab-7bdc83d0df7e | - | volumes | KBc-T0-U-R0-N0-V2 | ed95d6c3-497e-4e5f-99b1-8f9c5bd82a54 | - | volumes | KBc-T0-U-R0-N0-V16 | 7083ac1d-1383-4a6f-b95c-cc11c5fe4eda | - | sec_groups | KBc-T0-U-R0-N0-SG0 | b324ce05-384a-40e5-95f9-4e7e9dccb9d8 | - | routers | KBc-T0-U-R0 | 143a6fc6-5558-41c9-90cf-a08c4d26d37e | - | networks | KBc-T0-U-R0-N0 | d300fe6d-260b-4a99-99bc-a6a187c0fbc3 | - | tenants | KBc-T0 | 5d344c4be893420d9d94c7434143b09d | - | users | KBc-T0-U | d26097b180c64e34b80bfa4e73418267 | - +------------+--------------------+--------------------------------------+ - - - Warning: You didn't specify a resource list file as the input. The script will delete all resources shown above. - Are you sure? (y/n) y - *** STORAGE cleanup - + VOLUME KBc-T0-U-R0-N0-V34 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V36 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V4 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V3 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V7 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V5 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V31 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V17 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V29 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V9 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V1 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V13 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V20 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V33 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V10 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V35 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V25 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V22 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V6 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V37 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V32 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V0 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V38 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V23 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V11 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V18 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V39 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V19 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V12 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V8 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V30 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V21 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V28 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V14 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V15 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V26 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V27 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V24 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V2 is successfully deleted - + VOLUME KBc-T0-U-R0-N0-V16 is successfully deleted - *** COMPUTE cleanup - *** NETWORK cleanup - + SECURITY GROUP KBc-T0-U-R0-N0-SG0 is successfully deleted - + Router Gateway KBc-T0-U-R0 is successfully deleted - + Router Interface 10.1.0.3 is successfully deleted - + ROUTER KBc-T0-U-R0 is successfully deleted - + NETWORK KBc-T0-U-R0-N0 is successfully deleted - *** KEYSTONE cleanup - + USER KBc-T0-U is successfully deleted - + TENANT KBc-T0 is successfully deleted + $ python force_cleanup.py -r admin-oper.sh + Please enter your OpenStack Password: + Discovering Storage resources... + Discovering Compute resources... + Discovering Network resources... + Discovering Keystone resources... + + + SELECTED RESOURCES: + +------------+--------------------+--------------------------------------+ + | Type | Name | UUID | + |------------+--------------------+--------------------------------------| + | volumes | KBc-T0-U-R0-N0-V34 | 8a7746b1-5c31-4db8-b80e-58baeb21b2e9 | + | volumes | KBc-T0-U-R0-N0-V36 | b1f007e6-e46f-4b25-beca-8418f8680377 | + | volumes | KBc-T0-U-R0-N0-V4 | 5168c8fb-2124-4c00-9365-0767551a1861 | + | volumes | KBc-T0-U-R0-N0-V3 | d02dd62b-cd12-4e75-8356-cf41f3d3bc86 | + | volumes | KBc-T0-U-R0-N0-V7 | 32f50b20-3d8c-46f8-8e0e-1e642fe52a67 | + | volumes | KBc-T0-U-R0-N0-V5 | 4ee5710f-8cb6-454d-8661-ac5daa0dec35 | + | volumes | KBc-T0-U-R0-N0-V31 | 5eae2777-6680-4d63-907f-9b9280bdab36 | + | volumes | KBc-T0-U-R0-N0-V17 | cd44d985-468c-4d15-a26a-3205966f56bf | + | volumes | KBc-T0-U-R0-N0-V29 | 20cfd301-6f24-4727-a2e6-ec4c7979f24a | + | volumes | KBc-T0-U-R0-N0-V9 | ab7a09cd-4176-4119-89bb-44f22e42ac57 | + | volumes | KBc-T0-U-R0-N0-V1 | 467c6203-b30a-460d-9654-79e3798814ad | + | volumes | KBc-T0-U-R0-N0-V13 | 9b8c1697-a691-4ca8-b8aa-0ba5126f4330 | + | volumes | KBc-T0-U-R0-N0-V20 | 2fae40bd-b7f8-4ad0-8b49-28199cc20219 | + | volumes | KBc-T0-U-R0-N0-V33 | 29949338-9fb0-4a6f-8df5-65a97cfc5b5c | + | volumes | KBc-T0-U-R0-N0-V10 | 562a7f29-e0d4-479d-a916-deb7b062d826 | + | volumes | KBc-T0-U-R0-N0-V35 | 9643b353-ac1b-4088-940d-babdfed8239a | + | volumes | KBc-T0-U-R0-N0-V25 | 1d605aed-ad92-469a-a3ae-d8763793b764 | + | volumes | KBc-T0-U-R0-N0-V22 | 895ba475-debb-4b06-9372-dabebfd26b1c | + | volumes | KBc-T0-U-R0-N0-V6 | f0c3659a-b9ef-4b15-a015-35fc845a8509 | + | volumes | KBc-T0-U-R0-N0-V37 | df749f20-f2a9-4d8e-b1c5-667c3c64bf15 | + | volumes | KBc-T0-U-R0-N0-V32 | 5cca56d7-9543-470e-a964-1f6a314ee3a7 | + | volumes | KBc-T0-U-R0-N0-V0 | eb4e82d7-131e-417a-9bbb-0aedbd3c2263 | + | volumes | KBc-T0-U-R0-N0-V38 | 65737d70-c41d-4a3d-853e-ae4c9ecae44d | + | volumes | KBc-T0-U-R0-N0-V23 | 04c5bcdb-49b5-4006-9479-1f15b530cfcc | + | volumes | KBc-T0-U-R0-N0-V11 | 181c2dc4-56fd-4f42-ab5d-5e9f9b8a3be5 | + | volumes | KBc-T0-U-R0-N0-V18 | 6f78f429-6603-4dba-9fa0-cbc601c170a1 | + | volumes | KBc-T0-U-R0-N0-V39 | b9878b28-9a34-43b0-a5ea-46f7598b23f7 | + | volumes | KBc-T0-U-R0-N0-V19 | 1a2ef52a-a990-4cb8-974e-2e7bfde07e64 | + | volumes | KBc-T0-U-R0-N0-V12 | 78761313-89d0-47df-b8a6-6d6baac5a48d | + | volumes | KBc-T0-U-R0-N0-V8 | 712c06bb-75a1-4d3b-8e7e-1d1845e2636e | + | volumes | KBc-T0-U-R0-N0-V30 | baaffd6c-ed0c-41c8-9f81-a59e8cef8318 | + | volumes | KBc-T0-U-R0-N0-V21 | 4ef6e3fd-e102-45f2-b69f-cc28049667b4 | + | volumes | KBc-T0-U-R0-N0-V28 | 728edd5d-df01-4eae-8811-1e8e0c1357d6 | + | volumes | KBc-T0-U-R0-N0-V14 | 33fe1128-a4da-4d68-b3fe-e160856c2b46 | + | volumes | KBc-T0-U-R0-N0-V15 | 7fac9831-2ade-487f-9c79-126b5981df5a | + | volumes | KBc-T0-U-R0-N0-V26 | 801f95d4-1100-4bbd-9ec1-5fbe925b70d5 | + | volumes | KBc-T0-U-R0-N0-V27 | 61802296-9201-4d7a-aeda-62f2ad8b2de2 | + | volumes | KBc-T0-U-R0-N0-V24 | 9fab9127-a496-41ad-b8ab-7bdc83d0df7e | + | volumes | KBc-T0-U-R0-N0-V2 | ed95d6c3-497e-4e5f-99b1-8f9c5bd82a54 | + | volumes | KBc-T0-U-R0-N0-V16 | 7083ac1d-1383-4a6f-b95c-cc11c5fe4eda | + | sec_groups | KBc-T0-U-R0-N0-SG0 | b324ce05-384a-40e5-95f9-4e7e9dccb9d8 | + | routers | KBc-T0-U-R0 | 143a6fc6-5558-41c9-90cf-a08c4d26d37e | + | networks | KBc-T0-U-R0-N0 | d300fe6d-260b-4a99-99bc-a6a187c0fbc3 | + | tenants | KBc-T0 | 5d344c4be893420d9d94c7434143b09d | + | users | KBc-T0-U | d26097b180c64e34b80bfa4e73418267 | + +------------+--------------------+--------------------------------------+ + + + Warning: You didn't specify a resource list file as the input. The script will delete all resources shown above. + Are you sure? (y/n) y + *** STORAGE cleanup + + VOLUME KBc-T0-U-R0-N0-V34 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V36 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V4 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V3 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V7 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V5 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V31 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V17 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V29 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V9 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V1 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V13 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V20 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V33 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V10 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V35 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V25 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V22 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V6 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V37 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V32 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V0 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V38 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V23 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V11 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V18 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V39 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V19 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V12 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V8 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V30 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V21 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V28 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V14 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V15 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V26 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V27 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V24 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V2 is successfully deleted + + VOLUME KBc-T0-U-R0-N0-V16 is successfully deleted + *** COMPUTE cleanup + *** NETWORK cleanup + + SECURITY GROUP KBc-T0-U-R0-N0-SG0 is successfully deleted + + Router Gateway KBc-T0-U-R0 is successfully deleted + + Router Interface 10.1.0.3 is successfully deleted + + ROUTER KBc-T0-U-R0 is successfully deleted + + NETWORK KBc-T0-U-R0-N0 is successfully deleted + *** KEYSTONE cleanup + + USER KBc-T0-U is successfully deleted + + TENANT KBc-T0 is successfully deleted - $ Delete all resources with a name starting with "HA":: - $ python force_cleanup.py -r admin-openrc.sh --filter 'HA' - Discovering Storage resources... - Discovering Compute resources... - Discovering Network resources... - Discovering Keystone resources... - - SELECTED RESOURCES: - +----------+----------------------------------------------------+--------------------------------------+ - | Type | Name | UUID | - |----------+----------------------------------------------------+--------------------------------------| - | networks | HA network tenant b4d72c4ec4254c789ee11700e3f6d7a4 | ed2912db-4a56-4673-828c-c825e9f8d7ac | - | networks | HA network tenant 890190a4482448d197606d663702efc2 | 32ee3483-8aee-4a97-a2d2-62ac7e521c67 | - | networks | HA network tenant 0550a6a1045a40a1aa9cf3b92731ef00 | 586cc6e2-eec8-4927-8100-993027b6c925 | - | networks | HA network tenant 3c0a953100964440ac1bc8c1611ce96e | fa3ff23e-7a62-458d-911f-299f938685a0 | - | networks | HA network tenant 74a1ec7f4155403cbb482ea6be857295 | 09cee2bc-a2b7-4680-a6f0-542881f0fcd2 | - | networks | HA network tenant 45f2158c9fd2496ab68c51ef69d0cb80 | df6e0506-9ede-4df9-adc1-11f3046a94c6 | - | networks | HA network tenant 19dec7d3b39c48ef85b9d5e2500361f5 | 227c1e27-b117-43d6-9f0e-e1bd11993c05 | - | networks | HA network tenant 5d344c4be893420d9d94c7434143b09d | c3c2eebb-95b0-4a0c-b700-5591b4992ce1 | - +----------+----------------------------------------------------+--------------------------------------+ - - Warning: You didn't specify a resource list file as the input. The script will delete all resources shown above. - Are you sure? (y/n) y - *** STORAGE cleanup - *** COMPUTE cleanup - *** NETWORK cleanup - + NETWORK HA network tenant b4d72c4ec4254c789ee11700e3f6d7a4 is successfully deleted - + NETWORK HA network tenant 890190a4482448d197606d663702efc2 is successfully deleted - + NETWORK HA network tenant 0550a6a1045a40a1aa9cf3b92731ef00 is successfully deleted - + NETWORK HA network tenant 3c0a953100964440ac1bc8c1611ce96e is successfully deleted - + NETWORK HA network tenant 74a1ec7f4155403cbb482ea6be857295 is successfully deleted - + NETWORK HA network tenant 45f2158c9fd2496ab68c51ef69d0cb80 is successfully deleted - + NETWORK HA network tenant 19dec7d3b39c48ef85b9d5e2500361f5 is successfully deleted - + NETWORK HA network tenant 5d344c4be893420d9d94c7434143b09d is successfully deleted - *** KEYSTONE cleanup - $ + $ python force_cleanup.py -r admin-openrc.sh --filter 'HA' + Discovering Storage resources... + Discovering Compute resources... + Discovering Network resources... + Discovering Keystone resources... + + SELECTED RESOURCES: + +----------+----------------------------------------------------+--------------------------------------+ + | Type | Name | UUID | + |----------+----------------------------------------------------+--------------------------------------| + | networks | HA network tenant b4d72c4ec4254c789ee11700e3f6d7a4 | ed2912db-4a56-4673-828c-c825e9f8d7ac | + | networks | HA network tenant 890190a4482448d197606d663702efc2 | 32ee3483-8aee-4a97-a2d2-62ac7e521c67 | + | networks | HA network tenant 0550a6a1045a40a1aa9cf3b92731ef00 | 586cc6e2-eec8-4927-8100-993027b6c925 | + | networks | HA network tenant 3c0a953100964440ac1bc8c1611ce96e | fa3ff23e-7a62-458d-911f-299f938685a0 | + | networks | HA network tenant 74a1ec7f4155403cbb482ea6be857295 | 09cee2bc-a2b7-4680-a6f0-542881f0fcd2 | + | networks | HA network tenant 45f2158c9fd2496ab68c51ef69d0cb80 | df6e0506-9ede-4df9-adc1-11f3046a94c6 | + | networks | HA network tenant 19dec7d3b39c48ef85b9d5e2500361f5 | 227c1e27-b117-43d6-9f0e-e1bd11993c05 | + | networks | HA network tenant 5d344c4be893420d9d94c7434143b09d | c3c2eebb-95b0-4a0c-b700-5591b4992ce1 | + +----------+----------------------------------------------------+--------------------------------------+ + + Warning: You didn't specify a resource list file as the input. The script will delete all resources shown above. + Are you sure? (y/n) y + *** STORAGE cleanup + *** COMPUTE cleanup + *** NETWORK cleanup + + NETWORK HA network tenant b4d72c4ec4254c789ee11700e3f6d7a4 is successfully deleted + + NETWORK HA network tenant 890190a4482448d197606d663702efc2 is successfully deleted + + NETWORK HA network tenant 0550a6a1045a40a1aa9cf3b92731ef00 is successfully deleted + + NETWORK HA network tenant 3c0a953100964440ac1bc8c1611ce96e is successfully deleted + + NETWORK HA network tenant 74a1ec7f4155403cbb482ea6be857295 is successfully deleted + + NETWORK HA network tenant 45f2158c9fd2496ab68c51ef69d0cb80 is successfully deleted + + NETWORK HA network tenant 19dec7d3b39c48ef85b9d5e2500361f5 is successfully deleted + + NETWORK HA network tenant 5d344c4be893420d9d94c7434143b09d is successfully deleted + *** KEYSTONE cleanup -Dry run mode, regular expression, environment variable credentials, find all resources with a name ending with "ext":: +Dry run mode, regular expression, environment variable credentials, find all +resources with a name ending with "ext":: - $ python force_cleanup.py --dryrun --filter '.*ext$' - Discovering Storage resources... - Discovering Compute resources... - Discovering Network resources... - Discovering Keystone resources... - - !!! DRY RUN - RESOURCES WILL BE CHECKED BUT WILL NOT BE DELETED !!! - - SELECTED RESOURCES: - +----------+-------------+--------------------------------------+ - | Type | Name | UUID | - |----------+-------------+--------------------------------------| - | networks | storm-b-ext | a9e91d24-bb21-4321-a0d5-3408d15b25b4 | - +----------+-------------+--------------------------------------+ - - - *** STORAGE cleanup - *** COMPUTE cleanup - *** NETWORK cleanup - + NETWORK storm-b-ext should be deleted (but is not deleted: dry run) - *** KEYSTONE cleanup - $ + $ python force_cleanup.py --dryrun --filter '.*ext$' + Discovering Storage resources... + Discovering Compute resources... + Discovering Network resources... + Discovering Keystone resources... + + !!! DRY RUN - RESOURCES WILL BE CHECKED BUT WILL NOT BE DELETED !!! + + SELECTED RESOURCES: + +----------+-------------+--------------------------------------+ + | Type | Name | UUID | + |----------+-------------+--------------------------------------| + | networks | storm-b-ext | a9e91d24-bb21-4321-a0d5-3408d15b25b4 | + +----------+-------------+--------------------------------------+ + *** STORAGE cleanup + *** COMPUTE cleanup + *** NETWORK cleanup + + NETWORK storm-b-ext should be deleted (but is not deleted: dry run) + *** KEYSTONE cleanup + diff --git a/kloudbuster/cfg.scale.yaml b/kloudbuster/cfg.scale.yaml index 6d2e766..f4ccf5a 100644 --- a/kloudbuster/cfg.scale.yaml +++ b/kloudbuster/cfg.scale.yaml @@ -103,10 +103,16 @@ client: progression: # Enable/Disable the progression enabled: False - # The starting count of VMs + # The starting count of VMs: + # 0: Start directly from vm_multiple; + # 1: Start from 1 VM; vm_start: 1 # The steping for the VM count for each stage - vm_step: 1 + # e.g. KloudBuster will run iterations on below sequences: + # {'vm_start': 1, 'vm_multiple': 2}: 1, 2, 4, 6, 8... [DEFAULT] + # {'vm_start': 1, 'vm_multiple': 5}: 1, 5, 10, 15, 20... + # {'vm_start': 0, 'vm_multiple': 5}: 5, 10, 15, 20... + vm_multiple: 2 # The stop condition for HTTP benchmarking, it is used for KloudBuster to # determine when to stop the progression, and do the cleanup if needed. # It defines as: diff --git a/kloudbuster/kb_runner_http.py b/kloudbuster/kb_runner_http.py index 4ed5616..b6bdf93 100644 --- a/kloudbuster/kb_runner_http.py +++ b/kloudbuster/kb_runner_http.py @@ -120,7 +120,7 @@ class KBRunner_HTTP(KBRunner): if self.config.progression.enabled: self.tool_result = {} start = self.config.progression.vm_start - step = self.config.progression.vm_step + multiple = self.config.progression.vm_multiple limit = self.config.progression.http_stop_limit timeout = self.config.http_tool_configs.timeout vm_list = self.full_client_dict.keys() @@ -130,7 +130,10 @@ class KBRunner_HTTP(KBRunner): while True: cur_vm_count = len(self.client_dict) - target_vm_count = start + (cur_stage - 1) * step + if start == 1: + target_vm_count = 1 if cur_stage == 1 else (cur_stage - 1) * multiple + else: + target_vm_count = cur_stage * multiple timeout_at_percentile = 0 if target_vm_count > len(self.full_client_dict): break diff --git a/kloudbuster/kb_runner_storage.py b/kloudbuster/kb_runner_storage.py index 6340de9..06d5aa4 100644 --- a/kloudbuster/kb_runner_storage.py +++ b/kloudbuster/kb_runner_storage.py @@ -32,17 +32,42 @@ class KBRunner_Storage(KBRunner): KBRunner.__init__(self, client_list, config, expected_agent_version, single_cloud=True) def header_formatter(self, stage, vm_count): - rr_iops = vm_count * self.config.storage_tool_configs[0].rate_iops - rw_iops = vm_count * self.config.storage_tool_configs[1].rate_iops - sr_tp = self.config.storage_tool_configs[2].rate.upper() - ex_unit = sr_tp[-1] if sr_tp[-1] in ['K', 'M', 'G', 'T'] else None - sr_tp = (str(vm_count * int(sr_tp[:-1])) + ex_unit) if ex_unit else vm_count * int(sr_tp) - sw_tp = self.config.storage_tool_configs[3].rate.upper() - ex_unit = sw_tp[-1] if sw_tp[-1] in ['K', 'M', 'G', 'T'] else None - sw_tp = (str(vm_count * int(sw_tp[:-1])) + ex_unit) if ex_unit else vm_count * int(sw_tp) + rr_iops = rw_iops = sr_tp = sw_tp = 0 + for tc in self.config.storage_tool_configs: + if tc.mode == 'randread': + rr_iops = vm_count * tc.rate_iops + if tc.mode == 'randwrite': + rw_iops = vm_count * tc.rate_iops + if tc.mode == 'read': + sr_tp = tc.rate.upper() + ex_unit = sr_tp[-1] if sr_tp[-1] in ['K', 'M', 'G', 'T'] else None + sr_tp = (str(vm_count * int(sr_tp[:-1])) + ex_unit)\ + if ex_unit else vm_count * int(sr_tp) + if tc.mode == 'write': + sw_tp = tc.rate.upper() + ex_unit = sw_tp[-1] if sw_tp[-1] in ['K', 'M', 'G', 'T'] else None + sw_tp = (str(vm_count * int(sw_tp[:-1])) + ex_unit)\ + if ex_unit else vm_count * int(sw_tp) - msg = "Stage %d: %d VM(s), %d/%d(r/w) Expected IOPS, %sB/%sB(r/w) Expected Throughput" %\ - (stage, vm_count, rr_iops, rw_iops, sr_tp, sw_tp) + if rr_iops and rw_iops: + iops_str = ', %d/%d(r/w) Expected IOPS' % (rr_iops, rw_iops) + elif rr_iops: + iops_str = ', %d Read Expected IOPS' % (rr_iops) + elif rw_iops: + iops_str = ', %d Write Expected IOPS' % (rw_iops) + else: + iops_str = '' + + if sr_tp and sw_tp: + tp_str = ', %sB/%sB(r/w) Expected Throughput' % (sr_tp, sw_tp) + elif sr_tp: + tp_str = ', %sB Read Expected Throughput' % (sr_tp) + elif sw_tp: + tp_str = ', %sB Write Expected Throughput' % (sw_tp) + else: + tp_str = '' + + msg = "Stage %d: %d VM(s)%s%s" % (stage, vm_count, iops_str, tp_str) return msg def init_volume(self, active_range, timeout=30): @@ -116,7 +141,7 @@ class KBRunner_Storage(KBRunner): if self.config.progression.enabled: self.tool_result = {} start = self.config.progression.vm_start - step = self.config.progression.vm_step + multiple = self.config.progression.vm_multiple limit = self.config.progression.storage_stop_limit vm_list = self.full_client_dict.keys() vm_list.sort(cmp=lambda x, y: cmp(int(x[x.rfind('I') + 1:]), int(y[y.rfind('I') + 1:]))) @@ -126,7 +151,11 @@ class KBRunner_Storage(KBRunner): while True: tc_flag = False cur_vm_count = len(self.client_dict) - target_vm_count = start + (cur_stage - 1) * step + if start == 1: + target_vm_count = 1 if cur_stage == 1 else (cur_stage - 1) * multiple + else: + target_vm_count = cur_stage * multiple + if target_vm_count > len(self.full_client_dict): break diff --git a/kloudbuster/kloudbuster.py b/kloudbuster/kloudbuster.py index 3a5733c..febb0d3 100755 --- a/kloudbuster/kloudbuster.py +++ b/kloudbuster/kloudbuster.py @@ -468,13 +468,13 @@ class KloudBuster(object): "multiple runs as listed:" stage = 1 start = self.client_cfg.progression.vm_start - step = self.client_cfg.progression.vm_step - cur_vm_count = start + multiple = self.client_cfg.progression.vm_multiple + cur_vm_count = 1 if start else multiple total_vm = self.get_tenant_vm_count(self.server_cfg) * \ self.server_cfg['number_tenants'] while (cur_vm_count <= total_vm): log_info += "\n" + self.kb_runner.header_formatter(stage, cur_vm_count) - cur_vm_count = start + stage * step + cur_vm_count = (stage + 1 - start) * multiple stage += 1 LOG.info(log_info)