from paxes_cinder.k2aclient import client import json import sys import logging def ssp_health_check(cs): check_results = cs.paxes.check_ssp_conf("/etc/cinder") check_results_for_json = cs.paxes.result_output_as_dict(check_results) json.dump(check_results_for_json, sys.stdout, sort_keys=True, indent=4) if __name__ == '__main__': k2acfg = k2asample.getk2acfg() k2asample.configure_logging(logging.getLevelName(k2acfg['loglevel'])) cs = client.Client(k2acfg['api_version'], k2acfg['k2_url'], k2acfg['k2_username'], k2acfg['k2_password'], k2_auditmemento=k2acfg['k2_auditmemento'], k2_certpath=k2acfg['k2_certpath'], retries=k2acfg['retries'], timeout=k2acfg['timeout'], excdir=k2acfg['excdir']) try: ssp_health_check(cs) except Exception as e: logging.exception(e)
"""Short program to generate input for Defect:SW222953 - K2 API:ETAG mechanism failing when updating LogicalUnits in a SharedStoragePool. To perform test work around in sharedstoragepool_manager needs to be disabled""" record = False if not record: fspec_in = "/tmp/tool_test_etag_2013-09-04_23-19-13_00000.pickle" fspec_out = '/tmp/tool_test_etag_2013-09-04_23-19-13_00000.txt' _report_from_k2serializedresponse(fspec_in, fspec_out) else: k2acfg = k2asample.getk2acfg() # k2asample.configure_logging(logging.getLevelName(k2acfg['loglevel'])) k2asample.configure_logging(logging.DEBUG, k2_loglevel=logging.WARNING) cs = client.Client(k2acfg['api_version'], k2acfg['k2_url'], k2acfg['k2_username'], k2acfg['k2_password'], k2_auditmemento=k2acfg['k2_auditmemento'], k2_certpath=k2acfg['k2_certpath'], retries=3, # k2acfg['retries'] timeout=120, # k2acfg['timeout'] excdir="/tmp/test_etag") # k2acfg['excdir'] cluster_id = "c38db666-ba8c-35d0-9fa6-d2bf0cc5ea4b" # cluster-e" cluster = cs.cluster.get(cluster_id) ssp_id = cluster.sharedstoragepool_id() # the ssp associated with the cluster # responses
def run_simulation_with_pool(): """Setup existing image pool and run""" k2acfg = k2asample.getk2acfg() k2asample.configure_logging(logging.getLevelName(k2acfg['loglevel'])) # k2asample.configure_logging(logging.DEBUG, # k2_loglevel=logging.WARNING, # logdir=expanduser("~")) # # gerald 238 # k2_url = "9.114.181.238" # k2_password = "******" # k2_url = "hmc5.watson.ibm.com" # k2_password = k2acfg['k2_password'] # cluster_id = "04628d39-67df-3047-b90e-c4d9b4057267" # p730_810_A # result_file = 'my_sim_003_gerald' # # gerald 168 # k2_url = "9.114.181.168" # k2_password = "******" # cluster_id = "02803f50-7063-3602-a304-fb54e4ca2d44" # p730_810_A # result_file = 'my_sim_003_gerald_168' # # N8 # title = "N8" # k2_url = "hmc5.watson.ibm.com" # k2_password = k2acfg['k2_password'] # cluster_id = "0c737495-d09a-337a-a7e9-6173d4bb6d20" # p730_810_A # result_file = 'my_sim_003' # N23 / N24 title = "N23/N24" k2_url = "hmc5.watson.ibm.com" k2_password = k2acfg['k2_password'] cluster_id = "ea1b0b5f-3b3a-39dc-bade-6e9cebd18bb2" # cluster-a result_file = 'my_sim_003_cluster_a' # # REJY # title = "REJY" # k2_url = "9.126.139.241" # k2_password = k2acfg['k2_password'] # cluster_id = "c43fbdcd-95f2-3b4a-b643-234ff00eded4" # TestCluster # result_file = 'my_sim_003_REJY' # # N7 # k2_url = "hmc5.watson.ibm.com" # k2_password = k2acfg['k2_password'] # cluster_id = "fe3fbe0f-5ba8-3374-ab75-7b653c9a57ff" # cluster-b # result_file = 'my_sim_003_N7' if not MOCK: cs = client.Client(k2acfg['api_version'], k2_url, # k2acfg['k2_url'], k2acfg['k2_username'], k2_password, # k2acfg['k2_password'], k2_auditmemento=k2acfg['k2_auditmemento'], k2_certpath=k2acfg['k2_certpath'], retries=30, # k2acfg['retries'] timeout=1200, # k2acfg['timeout'] excdir="/tmp/ssp_simulation") # k2acfg['excdir'] else: cs = None use_fake_images = True if not use_fake_images: existing = ["RHEL64"] image_pool = ImagePool(cs, cluster_id, existing) else: prefix = "P2Z-FAKEIMAGE-" num_images = 1 image_size = 1 thin = True lut = "VirtualIO_Image" fake = (prefix, num_images, image_size, thin, lut) image_pool = ImagePool(cs, cluster_id, fake=fake) print "Image_pool_size: >%d<" % (len(image_pool._images),) num_threads = 5 num_threads = 1 target_number_of_deploys = 30 target_number_of_deploys = 500 target_number_of_deploys = 5 target_number_of_deploys = 2000 target_number_of_deploys = 1000 min_deploys = 100 max_deploys = 200 max_deploys = 2000 min_snapshots = 100 max_snapshots = 200 s = simulation(title, cluster_id, image_pool, result_file, num_threads=num_threads, target_number_of_deploys=target_number_of_deploys, min_deploys=min_deploys, max_deploys=max_deploys, min_snapshots=min_snapshots, max_snapshots=max_snapshots) image_pool.destroy() r = {} r["total_number_of_image_deploys"] = s.total_number_of_image_deploys r["total_number_of_snapshot_deploys"] = s.total_number_of_snapshot_deploys r["total_number_of_snapshots"] = s.total_number_of_snapshots r["current_number_of_deploys"] = len(s.deploys) r["current_number_of_snapshots"] = len(s.snapshots) r["total_number_of_deploy_exceptions"] = \ s.total_number_of_deploy_exceptions r["total_number_of_delete_exceptions"] = \ s.total_number_of_delete_exceptions print "Result:" print json.dumps(r, indent=4)
" len(image_lu_pool): >%d<" % (len(deployed_image_pool), num_images)) ssp = _teardown_lu_pool(ssp, image_lu_pool) print ("Elapsed time for image pool teardown: >%f<" % (timer(laps),)) if __name__ == '__main__': eventlet.monkey_patch() k2acfg = k2asample.getk2acfg() # k2asample.configure_logging(logging.getLevelName(k2acfg['loglevel'])) k2asample.configure_logging(logging.DEBUG, k2_loglevel=logging.WARNING, logdir=expanduser("~")) cs = client.Client(k2acfg['api_version'], "9.114.181.235", # k2acfg['k2_url'], k2acfg['k2_username'], "Passw0rd", # k2acfg['k2_password'], k2_auditmemento=k2acfg['k2_auditmemento'], k2_certpath=k2acfg['k2_certpath'], retries=3, # k2acfg['retries'] timeout=120, # k2acfg['timeout'] excdir="/tmp/stress_ssp") # k2acfg['excdir'] try: # cluster_id = "a9dbe07f-30c4-3788-8f6f-659aa1d66502" cluster_id = "d5ddc649-dc7c-31b1-8a1a-b8ab9bc98153"