Пример #1
0
def addVol_client_Mount(vol, stdurl, tsmID, tsmName, ClientIP):
    startTime = ctime()
    result = create_volume(vol, stdurl)
    if result[0] == 'FAILED':
        endTime = ctime()
        print result[1]
        logAndresult(testcase, 'BLOCKED', result[1], startTime, endTime)
    else:
        print "Volume '%s' created successfully" % (vol['name'])

    startTime = ctime()
    logging.info('Listing volumes in the TSM "%s" w.r.t its TSM ID', tsmName)
    volList = listVolumeWithTSMId_new(stdurl, tsmID)
    if volList[0] == 'PASSED':
        logging.info('Volumes present in the TSM "%s"', tsmName)
    else:
        endTime = ctime()
        print 'Not able to list Volumes in TSM "%s" due to: ' \
                %(tsmName) + volList[1]
        logAndresult(testcase, 'BLOCKED', volList[1], startTime, endTime)

    volume_name = vol['name']
    get_volInfo = get_volume_info(volList[1], volume_name)
    volname, volid, vol_mntPoint = get_volInfo[1], get_volInfo[2], get_volInfo[
        3]
    logging.debug('volname: %s, volid: %s, vol_mntPoint: %s',\
            volname, volid, vol_mntPoint)

    startTime = ctime()
    addClient = addNFSclient(stdurl, volid, ClientIP)
    if addClient[0] == 'PASSED':
        print 'Added NFS client "%s" to volume "%s"' % (ClientIP, volname)
        logging.info('Added NFS client "%s" to volume "%s"', \
                        ClientIP, volname)
    else:
        endTime = ctime()
        logAndresult(testcase, 'BLOCKED', addClient[1], startTime, endTime)

    volume = {'TSMIPAddress' : tsmIP, 'mountPoint': vol_mntPoint,\
                'name' : volname}

    startTime = ctime()
    logging.info("Mounting NFS Share '%s'", volname)
    nfsMount = mountNFS(volume)
    if nfsMount == 'PASSED':
        logging.info('Mounted Nfs Share "%s" successfully', volume['name'])
    else:
        endTime = ctime()
        msg = 'failed to mount NFS share "%s"' % volume['name']
        logAndresult(testcase, 'FAILED', msg, startTime, endTime)

    return [volume, volid]
Пример #2
0
if volList[0] == 'PASSED':
    logging.info('Volumes present in the TSM "%s"', tsmName)
else:
    endTime = ctime()
    print 'Not able to list Volumes in TSM "%s" due to: ' \
            %(tsmName) + volList[1]
    logAndresult(testcase, 'BLOCKED', volList[1], startTime, endTime)

volume_name = vol['name']
get_volInfo = get_volume_info(volList[1], volume_name)
volname, volid, vol_mntPoint = get_volInfo[1], get_volInfo[2], get_volInfo[3]
logging.debug('volname: %s, volid: %s, vol_mntPoint: %s',\
                volname, volid, vol_mntPoint)

startTime = ctime()
addClient = addNFSclient(stdurl, volid, 'all')
if addClient[0] == 'PASSED':
    print 'Added NFS client "all" to volume "%s"' % volname
    logging.info('Added NFS client "all" to volume "%s"', volname)
else:
    endTime = ctime()
    logAndresult(testcase, 'BLOCKED', addClient[1], startTime, endTime)

volume = {'TSMIPAddress' : tsmIP, 'mountPoint': vol_mntPoint,\
                'name' : volname}

startTime = ctime()
logging.info("Mounting NFS Share '%s'", volname)
nfsMount = mountNFS(volume)
if nfsMount == 'PASSED':
    logging.info('Mounted Nfs Share "%s" successfully', volume['name'])
Пример #3
0
    logging.debug('"%s" was created successfully', volname)
    logging.info('volume provision was successful for "%s times"', n)

    volList = listVolumeWithTSMId_new(stdurl, tsmID)
    endTime = ctime()
    if volList[0] == 'FAILED':
        logAndresult(testcase, 'BLOCKED', volList[1], startTime, endTime)

    get_volInfo = get_volume_info(volList[1], volname)
    volid, vol_mntPoint = get_volInfo[2], get_volInfo[3]
    print volid, vol_mntPoint
    logging.debug('volname: %s, volid: %s, vol_mntPoint: %s',\
     volname, volid, vol_mntPoint)

    startTime = ctime()
    addClient = addNFSclient(stdurl, volid, 'ALL')
    endTime = ctime()
    if addClient[0] == 'FAILED':
        logAndresult(testcase, 'BLOCKED', addClient[1], startTime, endTime)
    logging.debug('Added nfs client "ALL" to the volume')

    volume = {'TSMIPAddress' : tsmIP, 'mountPoint': vol_mntPoint,\
     'name' : volname}

    nfsMount = mountNFS(volume)
    if nfsMount[0] == 'FAILED':
        msg = 'failed to mount NFS share "%s"' % (volume['name'])
        logAndresult(testcase, 'FAILED', msg, startTime, endTime)
    logging.info('Mounted Nfs Share "%s" successfully', volname)

    mount_point =  getoutput('mount | grep %s | awk \'{print $3}\'' \
Пример #4
0
###getting volumes id and mountpoint--------------------------------------------
for x in range(1, 6):
    volumes = listVolumeWithTSMId_new(STDURL, TSM_IDs[x - 1])
    if volumes[0] == 'PASSED':
        volumes = volumes[1]
    else:
        print 'Not able to list the volumes...'
        logging.error('Not able to list volumes %s', volumes[1])
        logging.debug('mount/umount 100 NFS volumes test case is blocked...')
        is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
    update_volid_mntpoint(volumes)
#------------------------------------------------------------------------------

###Updating network to access the share----------------------------------------
for x in range(1, 101):
    result = addNFSclient(STDURL, VOLUME_IDs[x - 1], 'ALL')
    if result[0] == 'FAILED' and 'already exists' in str(result[1]):
        pass
    elif result[0] == 'FAILED':
        endTime = ctime()
        print 'Not able to update network ALL to access NFS share'
        logging.error('Not able to update network ALL, Error: %s', result[1])
        logging.debug('mount/umount 100 NFS volumes test case is failed...')
        resultCollection('mount/umount 100 NFS volumes test case', \
                ['FAILED', ''], startTime, endTime)
        exit()
#------------------------------------------------------------------------------


def umount_all():
    if len(MOUNTED_SHARE) == 0:
Пример #5
0
for vol in volumes:
    vol_id = vol.get('id')
    vol_mnt_pt = vol.get('mountpoint')
'''

vol1_info = get_volume_info(volumes, VOL1_NAME)
vol1_id, vol1_mnt_pt = vol1_info[2], vol1_info[3]
print vol1_id, vol1_mnt_pt

vol2_info = get_volume_info(volumes, VOL2_NAME)
vol2_id, vol2_mnt_pt = vol2_info[2], vol2_info[3]
print vol2_id, vol2_mnt_pt

# Updating nfs client access property for both volume

result = addNFSclient(STDURL, vol1_id, 'ALL')
if result[0] == 'FAILED':
    logging.error('Testcase %s is blocked due to' \
            ': %s', tcName,result[1])
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)

result = addNFSclient(STDURL, vol2_id, 'ALL')
if result[0] == 'FAILED':
    logging.error('Testcase %s is blocked due to' \
            ': %s', tcName,result[1])
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)

# Form the command to mount source & destintion, will be sent to client for execution

source_mkdir_cmd = 'mkdir %s' % (CLIENT_NFS_MOUNT_PNT_1
                                 )  # Way to assign string where using %s
        volumes = listVolumeWithTSMId_new(STDURL, vsm_id)
        if volumes[0] == 'FAILED':
            logging.error('Testcase %s is blocked due to' \
                    ': %s', tcName, volumes[1])
            is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
        volumes = volumes[1]

        # Extract the vol_id & vol_mnt_pt from info obtained above
        for vol in volumes:
            if vol['name'] == '%s' % (VOL_NAME):
                vol_id = vol.get('id')
                vol_mnt_pt = vol.get('mountpoint')
                break

        # Updating nfs client access property for volume
        result = addNFSclient(STDURL, vol_id, 'ALL')
        if result[0] == 'FAILED':
            logging.error('Testcase %s is blocked due to' \
                    ': %s', result[1])
            is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)

        # mounting the NFS share to client
        volDir = {'mountPoint': vol_mnt_pt, 'TSMIPAddress': VSM_IP, 'name': \
                VOL_NAME}

        mountResult = mountNFS_new(volDir)
        verify_mount(mountResult)
        volMntPoint = 'mount/%s' % (vol_mnt_pt)
        userValues['anchor'] = volMntPoint

        #copying perticular vdconf template to new file to execute vdbench
Пример #7
0
if volList[0] == 'PASSED':
    logging.info('Volumes present in the TSM "%s"', tsmName)
else:
    endTime = ctime()
    print 'Not able to list Volumes in TSM "%s" due to: ' \
            %(tsmName) + volList[1]
    logAndresult(testcase, 'BLOCKED', volList[1], startTime, endTime)

volume_name = vol['name']
get_volInfo = get_volume_info(volList[1], volume_name)
volname, volid, vol_mntPoint = get_volInfo[1], get_volInfo[2], get_volInfo[3]
logging.debug('volname: %s, volid: %s, vol_mntPoint: %s',\
                volname, volid, vol_mntPoint)

startTime = ctime()
addClient = addNFSclient(stdurl, volid, ClientIP)
if addClient[0] == 'PASSED':
    print 'Added NFS client "%s" to volume "%s"' % (ClientIP, volname)
    logging.info('Added NFS client "%s" to volume "%s"', ClientIP, volname)
else:
    endTime = ctime()
    logAndresult(testcase, 'BLOCKED', addClient[1], startTime, endTime)

volume = {'TSMIPAddress' : tsmIP, 'mountPoint': vol_mntPoint,\
                'name' : volname}

startTime = ctime()
logging.info("Mounting NFS Share '%s'", volname)
nfsMount = mountNFS(volume)
if nfsMount == 'PASSED':
    logging.info('Mounted Nfs Share "%s" successfully', volume['name'])
Пример #8
0
STEP2 = True
get_ip = get_ntwInterfaceAndIP(VSM_IP)
if get_ip[0] == 'PASSED':
    LOCAL_MACHINE_IP = get_ip[1]
else:
    print 'Given VSM IP is not reachable from local client, please provide '\
            'reachable VSM IP address'
    logging.error('Given VSM IP is not reachable from local client, please '\
            'provide reachable VSM IP address')
    logging.debug('Mount NFS when Network set to perticular N/W is blocked')
    resultCollection('Mount NFS when Network set to perticular N/W test '\
            'case:', ['BLOCKED', ''], startTime, endTime)
    STEP2 = False

if STEP2:
    add_client_result = addNFSclient(STDURL, vol_id, LOCAL_MACHINE_IP)
    verify_ddNFSclient(add_client_result, LOCAL_MACHINE_IP, volumeDict['name'])
    mount_result = mountNFS_new(volume_dir)
    endTime = ctime()
    if mount_result[0] == 'PASSED':
        print 'Mount NFS when Network set to perticular N/W: Able to mount, '\
                'PASSED'
        logging.debug('Mount NFS when Network set to perticular N/W: Able to '\
                'mount, PASSED')
        resultCollection('Mount NFS when Network set to perticular N/W test '\
                'case:', ['PASSED', ''], startTime, endTime)
        time.sleep(5)
        logging.debug('Going to umount the NFS share...')
        result = umountVolume_new(volume_dir)
    else:
        print 'Mount NFS when Network set to perticular N/W: FAILED'
Пример #9
0
    logging.info('Volumes present in the TSM "%s"', tsmName)
else: 
    endTime = ctime()
    print 'Not able to list Volumes in TSM "%s" due to: ' \
            %(tsmName) + volList[1] 
    logAndresult(testcase, 'BLOCKED', volList[1], startTime, endTime)

volume_name = vol['name']
get_volInfo = get_volume_info(volList[1], volume_name)
volname, volid, vol_mntPoint = get_volInfo[1], get_volInfo[2], get_volInfo[3]
logging.debug('volname: %s, volid: %s, vol_mntPoint: %s',\
                volname, volid, vol_mntPoint)

##Adding Nfs Client to the volume
startTime = ctime()
addClient = addNFSclient(stdurl, volid, localClientIP)
if addClient[0] == 'PASSED':
    print 'Added NFS client "%s" to volume "%s"' \
            %(localClientIP, volname)
    logging.info('Added NFS client "%s" to volume "%s"', \
                    localClientIP, volname)
else:
    endTime = ctime()
    logAndresult(testcase, 'BLOCKED', addClient[1], startTime, endTime)

##Mounting Nfs share
volume = {'TSMIPAddress' : tsmIP, 'mountPoint': vol_mntPoint,\
                'name' : volname}
startTime = ctime()
logging.info("Mounting NFS Share '%s'", volname)
nfsMount = mountNFS(volume)
Пример #10
0
else:
    endTime = ctime()
    print 'Not able to list Volumes in TSM "%s" due to: ' \
            %(tsmName) + volList[1]
    logAndresult(testcase, 'BLOCKED', volList[1], startTime, endTime)

volume_name = vol['name']
get_volInfo = get_volume_info(volList[1], volume_name)
volname, volid, vol_mntPoint = get_volInfo[1], get_volInfo[2], get_volInfo[3]
logging.debug('volname: %s, volid: %s, vol_mntPoint: %s',\
                volname, volid, vol_mntPoint)

startTime = ctime()
logging.info('Adding NFS client "%s" to volume "%s"', \
                NfsClient, vol['name'])
addClient = addNFSclient(stdurl, volid, NfsClient)
if addClient[0] == 'PASSED':
    print 'Added NFS client "%s" to volume "%s"' % (NfsClient, volname)
    logging.info('Added NFS client "%s" to volume "%s"', NfsClient, volname)
else:
    endTime = ctime()
    logAndresult(testcase, 'BLOCKED', addClient[1], startTime, endTime)

#logging.info('Pinging the TSMIP "%s" to check its connectivity', tsmIP)
#os.system("ping -c 4 %s" %tsmIP)

volume = {'TSMIPAddress' : tsmIP, 'mountPoint': vol_mntPoint,\
                    'name' : volname}

startTime = ctime()
#mounting nfs share
Пример #11
0
    resultCollection('No volumes in TSM so test case is', \
                                     ['BLOCKED',''], startTime, endTime)
    exit()
else:
    volumes = data1['listFilesystemResponse']['filesystem']
    for vol in volumes:
        if vol['name'] == volume['name']:
            volId = vol['id']
            mount_p = vol['mountpoint']
            Tsm_ip = vol['ipaddress']
            volName = vol['name']
            logging.info("volume id and  mountpoint sucessfully received")

    ### set nfs client
    logging.info("Setting NFS clients to all")
    result_addnfs = addNFSclient(stdurl, volId, 'all')
    if result_addnfs[0] == 'PASSED':
        logging.info(" SUCCESSFUL %s " % result_addnfs)
        print("Adding NFS client was successful")

    elif result_addnfs[0] == 'FAILED':
        logging.info(" Failed to add NFS clients %s " % result_addnfs)
        endTime = ctime()
        resultCollection(' Failed to add NFS clients', \
                ['BLOCKED', ''], startTime, endTime)
        print("Adding NFS client FAILED %s " % result_addnfs)

    # mount and umount nfs volumes
    volume = {
        'name': volume['name'],
        'mountPoint': mount_p,