def delete_all_volumes(thread_threshold = 1000): session_uuid = acc_ops.login_as_admin() session_to = con_ops.change_global_config('identity', 'session.timeout', '720000') session_mc = con_ops.change_global_config('identity', 'session.maxConcurrent', '10000') delete_policy = test_lib.lib_set_delete_policy('volume', 'Direct') expunge_time = test_lib.lib_set_expunge_time('volume', 1) cond = res_ops.gen_query_conditions('status', '!=', 'Deleted') num = res_ops.query_resource_count(res_ops.VOLUME, cond) if num <= thread_threshold: volumes = res_ops.query_resource(res_ops.VOLUME, cond) do_delete_volumes(volumes, thread_threshold) else: start = 0 limit = thread_threshold - 1 curr_num = start volumes = [] while curr_num < num: volumes_temp = res_ops.query_resource_fields(res_ops.VOLUME, \ cond, None, ['uuid'], start, limit) volumes.extend(volumes_temp) curr_num += limit start += limit do_delete_volumes(volumes, thread_threshold) test_lib.lib_set_delete_policy('volume', delete_policy) test_lib.lib_set_expunge_time('volume', expunge_time) test_util.test_logger('Volumes destroy Success. Destroy %d Volumes.' % num)
def delete_all_volumes(thread_threshold=1000): session_uuid = acc_ops.login_as_admin() session_to = con_ops.change_global_config('identity', 'session.timeout', '720000') session_mc = con_ops.change_global_config('identity', 'session.maxConcurrent', '10000') delete_policy = test_lib.lib_set_delete_policy('volume', 'Direct') expunge_time = test_lib.lib_set_expunge_time('volume', 1) cond = res_ops.gen_query_conditions('status', '!=', 'Deleted') num = res_ops.query_resource_count(res_ops.VOLUME, cond) if num <= thread_threshold: volumes = res_ops.query_resource(res_ops.VOLUME, cond) do_delete_volumes(volumes, thread_threshold) else: start = 0 limit = thread_threshold - 1 curr_num = start volumes = [] while curr_num < num: volumes_temp = res_ops.query_resource_fields(res_ops.VOLUME, \ cond, None, ['uuid'], start, limit) volumes.extend(volumes_temp) curr_num += limit start += limit do_delete_volumes(volumes, thread_threshold) test_lib.lib_set_delete_policy('volume', delete_policy) test_lib.lib_set_expunge_time('volume', expunge_time) test_util.test_logger('Volumes destroy Success. Destroy %d Volumes.' % num)
def delete_all_volumes(thread_threshold=1000): session_uuid = acc_ops.login_as_admin() session_to = con_ops.change_global_config("identity", "session.timeout", "720000") session_mc = con_ops.change_global_config("identity", "session.maxConcurrent", "10000") delete_policy = test_lib.lib_set_delete_policy("volume", "Direct") expunge_time = test_lib.lib_set_expunge_time("volume", 1) cond = res_ops.gen_query_conditions("status", "!=", "Deleted") num = res_ops.query_resource_count(res_ops.VOLUME, cond) if num <= thread_threshold: volumes = res_ops.query_resource(res_ops.VOLUME, cond) do_delete_volumes(volumes, thread_threshold) else: start = 0 limit = thread_threshold - 1 curr_num = start volumes = [] while curr_num < num: volumes_temp = res_ops.query_resource_fields(res_ops.VOLUME, cond, None, ["uuid"], start, limit) volumes.extend(volumes_temp) curr_num += limit start += limit do_delete_volumes(volumes, thread_threshold) test_lib.lib_set_delete_policy("volume", delete_policy) test_lib.lib_set_expunge_time("volume", expunge_time) test_util.test_logger("Volumes destroy Success. Destroy %d Volumes." % num)
def set_delete_delay_time(self, delay_time): test_lib.lib_set_expunge_time(category = 'vm', value = delay_time) super(ZstackTestVm, self).set_delete_delay_time(delay_time)