Revision 3707f851

b/lib/backend.py
250 250
  outputarray['vg_size'] = vginfo['vg_size']
251 251
  outputarray['vg_free'] = vginfo['vg_free']
252 252

  
253
  hyper = hypervisor.GetHypervisor()
253
  hyper = hypervisor.GetHypervisor(_GetConfig())
254 254
  hyp_info = hyper.GetNodeInfo()
255 255
  if hyp_info is not None:
256 256
    outputarray.update(hyp_info)
......
285 285
  result = {}
286 286

  
287 287
  if 'hypervisor' in what:
288
    result['hypervisor'] = hypervisor.GetHypervisor().Verify()
288
    result['hypervisor'] = hypervisor.GetHypervisor(_GetConfig()).Verify()
289 289

  
290 290
  if 'filelist' in what:
291 291
    result['filelist'] = utils.FingerprintFiles(what['filelist'])
......
425 425

  
426 426
  """
427 427
  try:
428
    names = hypervisor.GetHypervisor().ListInstances()
428
    names = hypervisor.GetHypervisor(_GetConfig()).ListInstances()
429 429
  except errors.HypervisorError, err:
430 430
    logging.exception("Error enumerating instances")
431 431
    raise
......
449 449
  """
450 450
  output = {}
451 451

  
452
  iinfo = hypervisor.GetHypervisor().GetInstanceInfo(instance)
452
  iinfo = hypervisor.GetHypervisor(_GetConfig()).GetInstanceInfo(instance)
453 453
  if iinfo is not None:
454 454
    output['memory'] = iinfo[2]
455 455
    output['state'] = iinfo[4]
......
477 477
  """
478 478
  output = {}
479 479

  
480
  iinfo = hypervisor.GetHypervisor().GetAllInstancesInfo()
480
  iinfo = hypervisor.GetHypervisor(_GetConfig()).GetAllInstancesInfo()
481 481
  if iinfo:
482 482
    for name, inst_id, memory, vcpus, state, times in iinfo:
483 483
      output[name] = {
......
676 676
    return True
677 677

  
678 678
  block_devices = _GatherBlockDevs(instance)
679
  hyper = hypervisor.GetHypervisor()
679
  hyper = hypervisor.GetHypervisor(_GetConfig())
680 680

  
681 681
  try:
682 682
    hyper.StartInstance(instance, block_devices, extra_args)
......
699 699
  if instance.name not in running_instances:
700 700
    return True
701 701

  
702
  hyper = hypervisor.GetHypervisor()
702
  hyper = hypervisor.GetHypervisor(_GetConfig())
703 703
  try:
704 704
    hyper.StopInstance(instance)
705 705
  except errors.HypervisorError, err:
......
747 747
    logging.error("Cannot reboot instance that is not running")
748 748
    return False
749 749

  
750
  hyper = hypervisor.GetHypervisor()
750
  hyper = hypervisor.GetHypervisor(_GetConfig())
751 751
  if reboot_type == constants.INSTANCE_REBOOT_SOFT:
752 752
    try:
753 753
      hyper.RebootInstance(instance)
......
772 772
  """Migrates an instance to another node.
773 773

  
774 774
  """
775
  hyper = hypervisor.GetHypervisor()
775
  hyper = hypervisor.GetHypervisor(_GetConfig())
776 776

  
777 777
  try:
778 778
    hyper.MigrateInstance(instance, target, live)
b/lib/cmdlib.py
3642 3642

  
3643 3643
    logger.Debug("connecting to console of %s on %s" % (instance.name, node))
3644 3644

  
3645
    hyper = hypervisor.GetHypervisor()
3645
    hyper = hypervisor.GetHypervisor(self.cfg)
3646 3646
    console_cmd = hyper.GetShellCommandForConsole(instance)
3647 3647

  
3648 3648
    # build ssh cmdline
b/lib/hypervisor/__init__.py
23 23

  
24 24
"""
25 25

  
26
from ganeti import ssconf
27 26
from ganeti import constants
28 27
from ganeti import errors
29 28

  
......
40 39
    }
41 40

  
42 41

  
43
def GetHypervisor():
42
def GetHypervisor(cfg):
44 43
  """Return a Hypervisor instance.
45 44

  
46 45
  This function parses the cluster hypervisor configuration file and
47 46
  instantiates a class based on the value of this file.
48 47

  
48
  @param cfg: Configuration object
49

  
49 50
  """
50
  ht_kind = ssconf.SimpleStore().GetHypervisorType()
51
  ht_kind = cfg.GetHypervisorType()
51 52

  
52 53
  if ht_kind not in _HYPERVISOR_MAP:
53 54
    raise errors.HypervisorError("Unknown hypervisor type '%s'" % ht_kind)

Also available in: Unified diff