Revision 5391d6b5

b/api/servers.py
473 473
    #                       overLimit (413)
474 474
    
475 475
    vm = util.get_vm(server_id, request.user)
476
    secret = util.encrypt(vm.backend_id)
477
    cpu = settings.CPU_GRAPH_URL_TEMPLATE % secret
478
    net = settings.NET_GRAPH_URL_TEMPLATE % secret
476
    #secret = util.encrypt(vm.backend_id)
477
    secret = vm.backend_id      # XXX disable backend id encryption
479 478
    
480 479
    stats = {
481 480
        'serverRef': vm.id,
482 481
        'refresh': settings.STATS_REFRESH_PERIOD,
483
        'cpu': cpu,
484
        'net': net}
482
        'cpuBar': settings.CPU_BAR_GRAPH_URL % secret,
483
        'cpuTimeSeries': settings.CPU_TIMESERIES_GRAPH_URL % secret,
484
        'netBar': settings.NET_BAR_GRAPH_URL % secret,
485
        'netTimeSeries': settings.NET_TIMESERIES_GRAPH_URL % secret}
485 486
    
486 487
    if request.serialization == 'xml':
487 488
        data = render_to_string('server_stats.xml', stats)
b/settings.d/20-api.conf
79 79
# Maximum number of VMs a user is allowed to have
80 80
MAX_VMS_PER_USER = 2
81 81

  
82
# URL templates for the stat graphs
83
CPU_GRAPH_URL_TEMPLATE = 'http://localhost/%s/cpu-bar.png'
84
NET_GRAPH_URL_TEMPLATE = 'http://localhost/%s/net-ts.png'
82
# URL templates for the stat graphs.
83
# The API implementation replaces '%s' with the encrypted backend id.
84
# FIXME: For now we do not encrypt the backend id.
85
CPU_BAR_GRAPH_URL = 'http://stats.okeanos.grnet.gr/%s/cpu-bar.png'
86
CPU_TIMESERIES_GRAPH_URL = 'http://stats.okeanos.grnet.gr/%s/cpu-ts.png'
87
NET_BAR_GRAPH_URL = 'http://stats.okeanos.grnet.gr/%s/net-bar.png'
88
NET_TIMESERIES_GRAPH_URL = 'http://stats.okeanos.grnet.gr/%s/net-ts.png'
85 89

  
86 90
# Recommended refresh period for server stats
87 91
STATS_REFRESH_PERIOD = 60
b/tools/cloud
45 45

  
46 46
TOKEN = '46e427d657b20defe352804f0eb6f8a2'
47 47

  
48
MARGIN = 14
48 49

  
49 50
commands = {}
50 51

  
......
57 58

  
58 59
def print_addresses(networks):
59 60
    for i, net in enumerate(networks):
60
        key = 'addresses:'.rjust(13) if i == 0 else ' ' * 13
61
        key = 'addresses:'.rjust(MARGIN + 1) if i == 0 else ' ' * (MARGIN + 1)
61 62
        addr = ''
62 63
        if 'values' in net:
63 64
            addr = '[%s]' % ' '.join(ip['addr'] for ip in net['values'])
......
77 78
        elif key == 'servers':
78 79
            val = ', '.join(str(server_id) for server_id in val['values'])
79 80
        if val or show_empty:
80
            print '%s: %s' % (key.rjust(12), val)
81
            print '%s: %s' % (key.rjust(MARGIN), val)
81 82

  
82 83

  
83 84
class Command(object):

Also available in: Unified diff