示例#1
0
文件: host.py 项目: davidddw/lcm
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
文件: host.py 项目: davidddw/lcm
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