Пример #1
0
def host_rescan(args):
    assert isinstance(args, dict)

    resp = call_patch_with_callback(TALKER_URL + 'hosts/%s/' % args['ip'],
                                    data={'ACTION': 'RESCAN'})

    if 'OPT_STATUS' not in resp or 'DESCRIPTION' not in resp:
        print >>sys.stderr, 'Error: response %s corrupted' % resp
        return -1

    if resp['OPT_STATUS'] != 'SUCCESS':
        print >>sys.stderr, 'Error (%s): %s' % (resp['OPT_STATUS'],
                                                resp['DESCRIPTION'])
        return -1

    print resp['DATA']['LCUUID']
    print >>sys.stderr, 'Please activate storage of this host before use'

    return 0
Пример #2
0
def host_rescan(args):
    assert isinstance(args, dict)

    resp = call_patch_with_callback(TALKER_URL + 'hosts/%s/' % args['ip'],
                                    data={'ACTION': 'RESCAN'})

    if 'OPT_STATUS' not in resp or 'DESCRIPTION' not in resp:
        print >> sys.stderr, 'Error: response %s corrupted' % resp
        return -1

    if resp['OPT_STATUS'] != 'SUCCESS':
        print >> sys.stderr, 'Error (%s): %s' % (resp['OPT_STATUS'],
                                                 resp['DESCRIPTION'])
        return -1

    print resp['DATA']['LCUUID']
    print >> sys.stderr, 'Please activate storage of this host before use'

    return 0
Пример #3
0
def host_switch(args):
    assert isinstance(args, dict)

    resp = call_patch_with_callback(TALKER_URL + 'hosts/%s/' % args['ip'],
                                    data={'ACTION': 'SWITCH'})

    if 'OPT_STATUS' not in resp or 'DESCRIPTION' not in resp:
        print >>sys.stderr, 'Error: response %s corrupted' % resp
        return -1

    if resp['OPT_STATUS'] != 'SUCCESS':
        print >>sys.stderr, 'Error (%s): %s' % (resp['OPT_STATUS'],
                                                resp['DESCRIPTION'])
        return -1

    print >>sys.stderr, 'VMs on host %s is switching, '\
        'you can view progress through seetalker' % resp['DATA']['IP']

    return 0
Пример #4
0
def host_switch(args):
    assert isinstance(args, dict)

    resp = call_patch_with_callback(TALKER_URL + 'hosts/%s/' % args['ip'],
                                    data={'ACTION': 'SWITCH'})

    if 'OPT_STATUS' not in resp or 'DESCRIPTION' not in resp:
        print >> sys.stderr, 'Error: response %s corrupted' % resp
        return -1

    if resp['OPT_STATUS'] != 'SUCCESS':
        print >> sys.stderr, 'Error (%s): %s' % (resp['OPT_STATUS'],
                                                 resp['DESCRIPTION'])
        return -1

    print >>sys.stderr, 'VMs on host %s is switching, '\
        'you can view progress through seetalker' % resp['DATA']['IP']

    return 0