# from randomload.actions.glance import delete as image_delete
from randomload.actions.glance import list as image_list
from randomload.actions.glance import usage as image_usage
from randomload.args import parser as argparser
from randomload.clients import ClientManager
from randomload.log import logging

logger = logging.getLogger('randomload')
logger.setLevel(logging.DEBUG)

if __name__ == '__main__':
    args = argparser.parse_args()
    conf = config.load(args.config_file)
    clients = ClientManager(**conf.get('auth_kwargs', {}))
    properties = {'app_id': 'randomload'}
    logger.info(image_list(clients, conf, **properties))

    now = datetime.datetime.utcnow()

    end = now
    start = end - datetime.timedelta(days=14)
    metadata = '{"color": "red"}'
    image_usage(clients, conf, start=start, end=end, metadata=metadata)
    logger.info("\n\n")

    end = now
    start = end - datetime.timedelta(days=14)
    metadata = '{}'
    image_usage(clients, conf, start=start, end=end, metadata=metadata)
    logger.info("\n\n")
Exemple #2
0
from randomload.clients import ClientManager
from randomload.log import logging

logger = logging.getLogger('randomload')

if __name__ == '__main__':
    args = argparser.parse_args()
    conf = config.load(args.config_file)
    clients = ClientManager(auth_url=conf.get('auth_url'),
                            username=conf.get('username'),
                            password=conf.get('password'),
                            project_id=conf.get('project_id'))

    server_list(clients, conf)
    volume_list(clients, conf)
    image_list(clients, conf)
    logger.info("\n\n")

    now = datetime.datetime.utcnow()

    end = now
    start = end - datetime.timedelta(days=14)
    metadata = '{"color": "red"}'
    server_usage(clients, conf, start=start, end=end, metadata=metadata)
    volume_usage(clients, conf, start=start, end=end, metadata=metadata)
    image_usage(clients, conf, start=start, end=end, metadata=metadata)
    logger.info("\n\n")

    end = now
    start = end - datetime.timedelta(days=14)
    metadata = '{}'
Exemple #3
0
logger = logging.getLogger('randomload')

if __name__ == '__main__':
    args = argparser.parse_args()
    conf = config.load(args.config_file)
    clients = ClientManager(
        auth_url=conf.get('auth_url'),
        username=conf.get('username'),
        password=conf.get('password'),
        project_id=conf.get('project_id')
    )

    server_list(clients, conf)
    volume_list(clients, conf)
    image_list(clients, conf)
    logger.info("\n\n")

    now = datetime.datetime.utcnow()

    end = now
    start = end - datetime.timedelta(days=14)
    metadata = '{"color": "red"}'
    server_usage(clients, conf, start=start, end=end, metadata=metadata)
    volume_usage(clients, conf, start=start, end=end, metadata=metadata)
    image_usage(clients, conf, start=start, end=end, metadata=metadata)
    logger.info("\n\n")

    end = now
    start = end - datetime.timedelta(days=14)
    metadata = '{}'