Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-ganeti
Commits
2584d4a4
Commit
2584d4a4
authored
Dec 18, 2007
by
Alexander Schreiber
Browse files
cleanup for hypervisor constants
Move constant definitions for hypervisor into constants.py Reviewed-by: ultrotter
parent
79caa9ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/cmdlib.py
View file @
2584d4a4
...
...
@@ -538,7 +538,7 @@ class LUInitCluster(LogicalUnit):
raise
errors
.
OpPrereqError
(
"Invalid mac prefix given '%s'"
%
self
.
op
.
mac_prefix
)
if
self
.
op
.
hypervisor_type
not
in
hypervisor
.
VALID_H
TYPES
:
if
self
.
op
.
hypervisor_type
not
in
constants
.
HYPER_
TYPES
:
raise
errors
.
OpPrereqError
(
"Invalid hypervisor type given '%s'"
%
self
.
op
.
hypervisor_type
)
...
...
lib/constants.py
View file @
2584d4a4
...
...
@@ -147,3 +147,9 @@ SSH_HOST_RSA_PUB = SSH_HOST_RSA_PRIV + ".pub"
INSTANCE_REBOOT_SOFT
=
"soft"
INSTANCE_REBOOT_HARD
=
"hard"
INSTANCE_REBOOT_FULL
=
"full"
# Hypervisor constants
HT_XEN30
=
"xen-3.0"
HT_FAKE
=
"fake"
HYPER_TYPES
=
frozenset
([
HT_XEN30
,
HT_FAKE
])
lib/hypervisor.py
View file @
2584d4a4
...
...
@@ -33,10 +33,6 @@ from ganeti import ssconf
from
ganeti
import
constants
from
ganeti.errors
import
HypervisorError
_HT_XEN30
=
"xen-3.0"
_HT_FAKE
=
"fake"
VALID_HTYPES
=
(
_HT_XEN30
,
_HT_FAKE
)
def
GetHypervisor
():
"""Return a Hypervisor instance.
...
...
@@ -46,9 +42,9 @@ def GetHypervisor():
"""
ht_kind
=
ssconf
.
SimpleStore
().
GetHypervisorType
()
if
ht_kind
==
_
HT_XEN30
:
if
ht_kind
==
constants
.
HT_XEN30
:
cls
=
XenHypervisor
elif
ht_kind
==
_
HT_FAKE
:
elif
ht_kind
==
constants
.
HT_FAKE
:
cls
=
FakeHypervisor
else
:
raise
HypervisorError
(
"Unknown hypervisor type '%s'"
%
ht_kind
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment