Revision a9369c6e lib/hypervisor/__init__.py

b/lib/hypervisor/__init__.py
31 31
from ganeti.hypervisor import hv_xen
32 32

  
33 33

  
34
_HYPERVISOR_MAP = {
35
    constants.HT_XEN_PVM30: hv_xen.XenPvmHypervisor,
36
    constants.HT_XEN_HVM31: hv_xen.XenHvmHypervisor,
37
    constants.HT_FAKE: hv_fake.FakeHypervisor,
38
    }
39

  
40

  
34 41
def GetHypervisor():
35 42
  """Return a Hypervisor instance.
36 43

  
......
39 46

  
40 47
  """
41 48
  ht_kind = ssconf.SimpleStore().GetHypervisorType()
42
  if ht_kind == constants.HT_XEN_PVM30:
43
    cls = hv_xen.XenPvmHypervisor
44
  elif ht_kind == constants.HT_XEN_HVM31:
45
    cls = hv_xen.XenHvmHypervisor
46
  elif ht_kind == constants.HT_FAKE:
47
    cls = hv_fake.FakeHypervisor
48
  else:
49

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

  
53
  cls = _HYPERVISOR_MAP[ht_kind]
50 54
  return cls()

Also available in: Unified diff