Revision e5a45a16
b/lib/backend.py | ||
---|---|---|
166 | 166 |
]) |
167 | 167 |
|
168 | 168 |
for hv_name in constants.HYPER_TYPES: |
169 |
hv_class = hypervisor.GetHypervisor(hv_name) |
|
169 |
hv_class = hypervisor.GetHypervisorClass(hv_name)
|
|
170 | 170 |
allowed_files.update(hv_class.GetAncillaryFiles()) |
171 | 171 |
|
172 | 172 |
return frozenset(allowed_files) |
b/lib/hypervisor/__init__.py | ||
---|---|---|
39 | 39 |
} |
40 | 40 |
|
41 | 41 |
|
42 |
def GetHypervisor(ht_kind): |
|
43 |
"""Return a Hypervisor instance.
|
|
42 |
def GetHypervisorClass(ht_kind):
|
|
43 |
"""Return a Hypervisor class.
|
|
44 | 44 |
|
45 |
This function parses the cluster hypervisor configuration file and
|
|
46 |
instantiates a class based on the value of this file.
|
|
45 |
This function returns the hypervisor class corresponding to the
|
|
46 |
given hypervisor name.
|
|
47 | 47 |
|
48 | 48 |
@type ht_kind: string |
49 | 49 |
@param ht_kind: The requested hypervisor type |
... | ... | |
53 | 53 |
raise errors.HypervisorError("Unknown hypervisor type '%s'" % ht_kind) |
54 | 54 |
|
55 | 55 |
cls = _HYPERVISOR_MAP[ht_kind] |
56 |
return cls |
|
57 |
|
|
58 |
|
|
59 |
def GetHypervisor(ht_kind): |
|
60 |
"""Return a Hypervisor instance. |
|
61 |
|
|
62 |
This is a wrapper over L{GetHypervisorClass} which returns an |
|
63 |
instance of the class. |
|
64 |
|
|
65 |
@type ht_kind: string |
|
66 |
@param ht_kind: The requested hypervisor type |
|
67 |
|
|
68 |
""" |
|
69 |
cls = GetHypervisorClass(ht_kind) |
|
70 |
|
|
56 | 71 |
return cls() |
Also available in: Unified diff