Ejemplo n.º 1
0
def tdd():
    execute(showStatus)

    with prefix(env_config.admin_openrc):
        runCheck("List service components", "cinder service-list")

    with prefix(env_config.demo_openrc):
        timestamp = run('date +"%Y-%m-%d %H:%M:%S"', quiet=True)
        runCheck("Create a 1 GB volume", "cinder create --display-name demo-volume1 1")

        msg = "Verify creation and availability of volume"
        run("cinder list")
        status = run("cinder list | awk '/demo-volume1/ {print $4}'", quiet=True)
        if not status:
            print align_n("There is no volume called demo-volume1")
            sys.exit(1)
        else:
            # volume takes a while to build, so we loop until it's done
            while status != "error" and status != "available":
                status = run("cinder list | awk '/demo-volume1/ {print $4}'", quiet=True)

            if status == "available":
                print align_y("demo-volume1 is available")
                runCheck("Delete test volume", "cinder delete demo-volume1")
            else:
                print align_n("Problem with demo-volume1:")
                checkLog(timestamp)
                runCheck("Delete test volume", "cinder delete demo-volume1")
                sys.exit(1)
Ejemplo n.º 2
0
def wait_to_finish(elementType, listCommand, elementName, finishWord):
    print(blue("Waiting for %s to finish" % elementType))
    with settings(warn_only=True):
        msg = 'Create %s' % elementType
        finishCheck = run("%s | grep %s | grep -i %s" %
                          (listCommand, elementName, finishWord),
                          quiet=True)
        while finishCheck == '':
            finishCheck = run("%s | grep %s | grep -i %s" %
                              (listCommand, elementName, finishWord),
                              quiet=True)
            time = run('date +"%Y-%m-%d %H:%M:%S"', quiet=True)
            errorCheck = run("%s | grep %s | grep -i ERROR" %
                             (listCommand, elementName),
                             quiet=True)
            if errorCheck != '':
                myLib.printMessage('oops', msg)
                errormsg = 'Failure on: ' + msg
                logging.error(errormsg)
                logging.error(errorCheck)
                myLib.checkLog(time)
                sys.exit("%s couldn't finish. Check logs above" % elementType)
        myLib.printMessage('good', msg)
        logging.info('Success on: ' + msg)
        logging.debug(finishCheck)
    print(green("%s done!" % elementType))
Ejemplo n.º 3
0
def tdd():
    execute(showStatus)

    with prefix(env_config.admin_openrc):
        runCheck('List service components', 'cinder service-list')

    with prefix(env_config.demo_openrc):
        timestamp = run('date +"%Y-%m-%d %H:%M:%S"', quiet=True)
        runCheck('Create a 1 GB volume',
                 'cinder create --display-name demo-volume1 1')

        msg = 'Verify creation and availability of volume'
        run('cinder list')
        status = run("cinder list | awk '/demo-volume1/ {print $4}'",
                     quiet=True)
        if not status:
            print align_n('There is no volume called demo-volume1')
            sys.exit(1)
        else:
            # volume takes a while to build, so we loop until it's done
            while status != 'error' and status != 'available':
                status = run("cinder list | awk '/demo-volume1/ {print $4}'",
                             quiet=True)

            if status == 'available':
                print align_y('demo-volume1 is available')
                runCheck('Delete test volume', 'cinder delete demo-volume1')
            else:
                print align_n('Problem with demo-volume1:')
                checkLog(timestamp)
                runCheck('Delete test volume', 'cinder delete demo-volume1')
                sys.exit(1)
Ejemplo n.º 4
0
def wait_to_finish(elementType, listCommand, elementName, finishWord):
    print(blue("Waiting for %s to finish" % elementType))
    with settings(warn_only=True):
        msg = 'Create %s' % elementType
        finishCheck = run("%s | grep %s | grep -i %s" % (listCommand, elementName, finishWord), quiet=True) 
        while finishCheck == '':
            finishCheck = run("%s | grep %s | grep -i %s" % (listCommand, elementName, finishWord), quiet=True) 
            time = run('date +"%Y-%m-%d %H:%M:%S"',quiet=True)
            errorCheck = run("%s | grep %s | grep -i ERROR" % (listCommand, elementName), quiet=True) 
            if errorCheck != '':
                myLib.printMessage('oops',msg)
                errormsg = 'Failure on: ' + msg
                logging.error(errormsg)
                logging.error(errorCheck)
                myLib.checkLog(time)
                sys.exit("%s couldn't finish. Check logs above" % elementType)
        myLib.printMessage('good',msg)
        logging.info('Success on: ' + msg)
        logging.debug(finishCheck)
    print(green("%s done!" % elementType))