Revision b705748e snf-cyclades-app/synnefo/logic/backend.py

b/snf-cyclades-app/synnefo/logic/backend.py
1
# Copyright 2011-2013 GRNET S.A. All rights reserved.
1
# Copyright 2011-2014 GRNET S.A. All rights reserved.
2 2
#
3 3
# Redistribution and use in source and binary forms, with or
4 4
# without modification, are permitted provided that the following
......
730 730
        return client.ModifyInstance(vm.backend_vm_id, beparams=beparams)
731 731

  
732 732

  
733
def get_instance_console(vm):
734
    # RAPI GetInstanceConsole() returns endpoints to the vnc_bind_address,
735
    # which is a cluster-wide setting, either 0.0.0.0 or 127.0.0.1, and pretty
736
    # useless (see #783).
737
    #
738
    # Until this is fixed on the Ganeti side, construct a console info reply
739
    # directly.
740
    #
741
    # WARNING: This assumes that VNC runs on port network_port on
742
    #          the instance's primary node, and is probably
743
    #          hypervisor-specific.
744
    #
745
    log.debug("Getting console for vm %s", vm)
746

  
747
    console = {}
748
    console['kind'] = 'vnc'
749

  
750
    with pooled_rapi_client(vm) as client:
751
        i = client.GetInstance(vm.backend_vm_id)
752

  
753
    if vm.backend.hypervisor == "kvm" and i['hvparams']['serial_console']:
754
        raise Exception("hv parameter serial_console cannot be true")
755
    console['host'] = i['pnode']
756
    console['port'] = i['network_port']
757

  
758
    return console
759

  
760

  
761 733
def get_instance_info(vm):
762 734
    with pooled_rapi_client(vm) as client:
763 735
        return client.GetInstance(vm.backend_vm_id)

Also available in: Unified diff