cloud-certification-team team mailing list archive
-
cloud-certification-team team
-
Mailing list archive
-
Message #00006
[Merge] lp:~jeffmarcom/cloud-testing/nova_delete_flavor_tests into lp:cloud-testing/cloudbox
Jeff Marcom has proposed merging lp:~jeffmarcom/cloud-testing/nova_delete_flavor_tests into lp:cloud-testing/cloudbox.
Requested reviews:
Cloud Certification (cloud-certification-team)
For more details, see:
https://code.launchpad.net/~jeffmarcom/cloud-testing/nova_delete_flavor_tests/+merge/174854
This adds several cleanup and specific jobs for nova compute flavor deletion tasks.
--
https://code.launchpad.net/~jeffmarcom/cloud-testing/nova_delete_flavor_tests/+merge/174854
Your team Cloud Certification is requested to review the proposed merge of lp:~jeffmarcom/cloud-testing/nova_delete_flavor_tests into lp:cloud-testing/cloudbox.
=== modified file 'cloudbox/openstack/component/compute.py'
--- cloudbox/openstack/component/compute.py 2013-06-26 16:27:43 +0000
+++ cloudbox/openstack/component/compute.py 2013-07-15 20:34:25 +0000
@@ -159,6 +159,10 @@
def list_flavors(cls):
return openstack_cli("nova").execute("flavor-list")
+ @classmethod
+ def delete_flavor(cls, name):
+ return openstack_cli("nova").execute("flavor-delete", name)
+
class FlavorAPI(object):
@@ -196,11 +200,32 @@
return openstack_api("nova").request("create_flavor", params)
@classmethod
- def list_flavors(self):
+ def list_flavors(cls):
api_obj = openstack_api("nova")
api_obj.page_tac = "/detail"
return api_obj.request("list_flavors")
+ @classmethod
+ def delete_flavor(cls, name):
+ # Retrieve ID for flavor name
+ flavors = cls.list_flavors()["flavors"]
+
+ id = ""
+ for item in flavors:
+ try:
+ if item["name"] == name:
+ id = item["id"]
+ except KeyError:
+ continue
+
+ if id == "":
+ logging.error("Failed finding flavor name: {}".format(name))
+ return
+
+ api_obj = openstack_api("nova")
+ api_obj.page_tac = "/" + id
+ return openstack_api("nova").request("delete_flavor")
+
class InstanceAPI(object):
=== modified file 'extras/whitelists/folsom_cleanup_local.whitelist'
--- extras/whitelists/folsom_cleanup_local.whitelist 2013-07-15 15:48:08 +0000
+++ extras/whitelists/folsom_cleanup_local.whitelist 2013-07-15 20:34:25 +0000
@@ -14,3 +14,5 @@
openstack/service_info
__folsom_local_glance__
glance/remove_image/local
+__folsom_local_nova__
+nova/delete_flavors/local
=== modified file 'extras/whitelists/folsom_cleanup_remote.whitelist'
--- extras/whitelists/folsom_cleanup_remote.whitelist 2013-07-15 15:48:08 +0000
+++ extras/whitelists/folsom_cleanup_remote.whitelist 2013-07-15 20:34:25 +0000
@@ -13,3 +13,4 @@
__folsom_remote__
openstack/service_info
glance/remove_image/remote
+nova/delete_flavors/remote
=== modified file 'extras/whitelists/folsom_compute_local.whitelist'
--- extras/whitelists/folsom_compute_local.whitelist 2013-06-18 15:13:45 +0000
+++ extras/whitelists/folsom_compute_local.whitelist 2013-07-15 20:34:25 +0000
@@ -13,6 +13,7 @@
__folsom_remote__
openstack/service_info
__folsom_local_nova__
+nova/delete_flavors/local
nova/update_tenant_instances/local
nova/update_tenant_vcpus/local
nova/update_tenant_ram/local
@@ -24,3 +25,8 @@
nova/add_flavor_xlarge/local
nova/launch_instance/local
nova/compute_benchmark/local
+nova/delete_flavor_tiny/local
+nova/delete_flavor_small/local
+nova/delete_flavor_medium/local
+nova/delete_flavor_large/local
+nova/delete_flavor_xlarge/local
=== modified file 'extras/whitelists/folsom_remote.whitelist'
--- extras/whitelists/folsom_remote.whitelist 2013-06-18 15:13:45 +0000
+++ extras/whitelists/folsom_remote.whitelist 2013-07-15 20:34:25 +0000
@@ -12,6 +12,7 @@
networking/detect
__folsom_remote__
openstack/service_info
+nova/delete_flavors/remote
nova/update_tenant_instances/remote
nova/update_tenant_vcpus/remote
nova/update_tenant_ram/remote
@@ -25,3 +26,8 @@
nova/launch_instance/remote
volume/create_block_storage/remote
nova/compute_benchmark/remote
+nova/delete_flavor_tiny/remote
+nova/delete_flavor_small/remote
+nova/delete_flavor_medium/remote
+nova/delete_flavor_large/remote
+nova/delete_flavor_xlarge/remote
=== modified file 'jobs/folsom_local_nova.txt.in'
--- jobs/folsom_local_nova.txt.in 2013-06-14 16:25:08 +0000
+++ jobs/folsom_local_nova.txt.in 2013-07-15 20:34:25 +0000
@@ -53,6 +53,42 @@
Adds xlarge instance flavor type to available flavor list via nova cli
plugin: shell
+name: nova/delete_flavors/local
+command: nova_cli_test flavor --delete
+_description:
+ Removes all instance flavor types from available flavor list via nova cli
+
+plugin: shell
+name: nova/delete_flavor_tiny/local
+command: nova_cli_test flavor --delete --name cert.tiny --debug
+_description:
+ Removes tiny instance flavor type from available flavor list via nova cli
+
+plugin: shell
+name: nova/delete_flavor_small/local
+command: nova_cli_test flavor --delete --name cert.small --debug
+_description:
+ Removes small instance flavor type from available flavor list via nova cli
+
+plugin: shell
+name: nova/delete_flavor_medium/local
+command: nova_cli_test flavor --delete --name cert.medium --debug
+_description:
+ Removes medium instance flavor type from available flavor list via nova cli
+
+plugin: shell
+name: nova/delete_flavor_large/local
+command: nova_cli_test flavor --delete --name cert.large --debug
+_description:
+ Removes large instance flavor type from available flavor list via nova cli
+
+plugin: shell
+name: nova/delete_flavor_xlarge/local
+command: nova_cli_test flavor --delete --name cert.xlarge --debug
+_description:
+ Removes xlarge instance flavor type from available flavor list via nova cli
+
+plugin: shell
name: nova/launch_instance/local
command: nova_cli_test instance --launch
_description:
=== modified file 'jobs/folsom_remote.txt.in'
--- jobs/folsom_remote.txt.in 2013-07-15 15:48:08 +0000
+++ jobs/folsom_remote.txt.in 2013-07-15 20:34:25 +0000
@@ -80,7 +80,43 @@
name: nova/add_flavor_xlarge/remote
command: nova_api_test flavor --add --type xlarge
_description:
- Adds xlarge instance flavor type to available flavor list via nova api
+ Adds xlarge instance flavor type to available flavor list via nova api
+
+plugin: shell
+name: nova/delete_flavors/remote
+command: nova_api_test flavor --delete
+_description:
+ Removes all instance flavor types from available flavor list via nova api
+
+plugin: shell
+name: nova/delete_flavor_tiny/remote
+command: nova_api_test flavor --delete --name cert.tiny
+_description:
+ Removes tiny instance flavor type from available flavor list via nova api
+
+plugin: shell
+name: nova/delete_flavor_small/remote
+command: nova_api_test flavor --delete --name cert.small
+_description:
+ Removes small instance flavor type from available flavor list via nova api
+
+plugin: shell
+name: nova/delete_flavor_medium/remote
+command: nova_api_test flavor --delete --name cert.medium
+_description:
+ Removes medium instance flavor type from available flavor list via nova api
+
+plugin: shell
+name: nova/delete_flavor_large/remote
+command: nova_api_test flavor --delete --name cert.large
+_description:
+ Removes large instance flavor type from available flavor list via nova api
+
+plugin: shell
+name: nova/delete_flavor_xlarge/remote
+command: nova_api_test flavor --delete --name cert.xlarge
+_description:
+ Removes xlarge instance flavor type from available flavor list via nova api
plugin: shell
name: nova/launch_instance/remote
=== modified file 'scripts/nova_api_test'
--- scripts/nova_api_test 2013-06-26 16:27:43 +0000
+++ scripts/nova_api_test 2013-07-15 20:34:25 +0000
@@ -97,6 +97,42 @@
print("SUCCESS: ", output)
+ if args.delete:
+ exit_code = 0
+ if args.name != "":
+ flavor_name = args.name
+ print("Attempting to remove flavor: ", flavor_name)
+
+ output = FlavorAPI.delete_flavor(flavor_name)
+ print(output)
+
+ try:
+ if flavor_name in FlavorAPI.list_flavors:
+ print("Failed removing flavor: ", flavor_name)
+ exit_code = 4
+ except TypeError:
+ logging.error("Failed parsing flavor list")
+
+ else:
+ print("Removing all flavors")
+ try:
+ flavors = FlavorAPI.list_flavors()["flavors"]
+ except KeyError:
+ print("Failed getting flavor info")
+
+ for flavor in flavors:
+ print(flavor)
+ try:
+ print(FlavorAPI.delete_flavor(flavor["name"]))
+ except KeyError:
+ print("Failed getting flavor name from output")
+ exit_code = 1
+ except TypeError:
+ print("Failed parsing flavor detail")
+ exit_code = 2
+
+ sys.exit(exit_code)
+
def compute_info(args):
@@ -186,9 +222,9 @@
spawn_counter = 0
for num in range(0, int(num_of_instances)):
- # The openstack API will only accept 10 POST
- # requests within a minute timeframe. For this
- # reason we have to sleep for 2 minutes after
+ # The openstack API will only accept 10 POST
+ # requests within a minute timeframe. For this
+ # reason we have to sleep for 2 minutes after
# spawning 10 instances before continuing testing.
if spawn_counter == 10:
print("Waiting 2 minutes to spawn next instance pool...")
@@ -338,6 +374,9 @@
help=("update limit for a tenant"))
compute_info_parser.add_argument('--debug', action="store_true")
flavor_test_parser.add_argument('--add', action="store_true")
+ flavor_test_parser.add_argument('--delete', action="store_true")
+ flavor_test_parser.add_argument(
+ '--name', type=str, default="", action="store")
flavor_test_parser.add_argument(
'--type', type=str, default="tiny",
choices=['tiny', 'small', 'medium', 'large', 'xlarge'])
=== modified file 'scripts/nova_cli_test'
--- scripts/nova_cli_test 2013-06-25 22:44:29 +0000
+++ scripts/nova_cli_test 2013-07-15 20:34:25 +0000
@@ -91,6 +91,24 @@
print("Failed adding flavor")
sys.exit(4)
+ if args.delete:
+ exit_code = 1
+ if args.name != "":
+ name = args.name
+ print("Attempting to remove flavor: ", name)
+ exit_code, output = FlavorCLI.delete_flavor(name)
+ else:
+ print("Attempting to remove all flavors")
+ flavors = json.loads(
+ openstack_cli.format_to_json(FlavorCLI.list_flavors()))
+
+ for entry in flavors:
+ flavor = flavors[entry]
+ print(flavor)
+ try:
+ exit_code, output = FlavorCLI.delete_flavor(flavor["Name"])
+ except (KeyError, IndexError):
+ continue
def compute_info(args):
# Default config values supplied in cloudbox
@@ -322,6 +340,9 @@
help=("update limit for a tenant"))
compute_info_parser.add_argument('--debug', action="store_true")
flavor_test_parser.add_argument('--add', action="store_true")
+ flavor_test_parser.add_argument('--delete', action="store_true")
+ flavor_test_parser.add_argument(
+ '--name', default="", type=str, action="store")
flavor_test_parser.add_argument(
'--type', type=str, default="tiny",
choices=['tiny', 'small', 'medium', 'large', 'xlarge'])
Follow ups