Revision 04c4330c lib/hypervisor/hv_xen.py

b/lib/hypervisor/hv_xen.py
212 212
    """Return a command for connecting to the console of an instance.
213 213

  
214 214
    """
215
    raise NotImplementedError
215
    return "xm console %s" % instance.name
216

  
216 217

  
217 218
  def Verify(self):
218 219
    """Verify the hypervisor.
......
359 360
                               " file /etc/xen/%s: %s" % (instance.name, err))
360 361
    return True
361 362

  
362
  @staticmethod
363
  def GetShellCommandForConsole(instance):
364
    """Return a command for connecting to the console of an instance.
365

  
366
    """
367
    return "xm console %s" % instance.name
368

  
369 363

  
370 364
class XenHvmHypervisor(XenHypervisor):
371 365
  """Xen HVM hypervisor interface"""
......
476 470
      raise errors.OpExecError("Cannot write Xen instance confile"
477 471
                               " file /etc/xen/%s: %s" % (instance.name, err))
478 472
    return True
479

  
480
  @staticmethod
481
  def GetShellCommandForConsole(instance):
482
    """Return a command for connecting to the console of an instance.
483

  
484
    """
485
    if instance.network_port is None:
486
      raise errors.OpExecError("no console port defined for %s"
487
                               % instance.name)
488
    elif instance.vnc_bind_address == constants.BIND_ADDRESS_GLOBAL:
489
      raise errors.OpExecError("no PTY console, connect to %s:%s via VNC"
490
                               % (instance.primary_node,
491
                                  instance.network_port))
492
    else:
493
      raise errors.OpExecError("no PTY console, connect to %s:%s via VNC"
494
                               % (instance.vnc_bind_address,
495
                                  instance.network_port))

Also available in: Unified diff