Esempio n. 1
0
import paxes_cinder.k2aclient.k2asample as k2asample
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)
Esempio n. 2
0
#
# =================================================================
# =================================================================

from __future__ import print_function

# from paxes_cinder.k2aclient.v1 import k2web
# from paxes_cinder.k2aclient.v1 import k2uom

import paxes_cinder.k2aclient.k2asample as k2asample
from paxes_cinder.k2aclient import client
import logging

if __name__ == '__main__':

    k2acfg = k2asample.getk2acfg(cfgfile="my_sadek_k2a.cfg")
    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:

        wfs = cs.web_file.list()
        for wf in wfs:
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)
    giga = float(fsize) / 1024. / 1024. / 1024.
    minu = float(upload_time) / 60.0
    rate = minu / giga
    webfile = cs.web_file.get(webfile.id)
    print ("upload complete: webfile id: >%s<, expected size: >%d< "
           "bytes, actual size: >%s< bytes, elapsed time: >%d< seconds, "
           "rate: >%f< minutes/GB, k2resp: >%s<" %
           (webfile.id, fsize, webfile.current_file_size_in_bytes,
            upload_time, rate, uploadexc))

    return webfile

if __name__ == '__main__':

    k2acfg = k2asample.getk2acfg(cfgfile="k2a.cfg")
    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:
        #########
        # Part one get nexus