Translate 'powervm' hypervisor_type to 'phyp' for scheduling

This adds a temporary translation of the 'powervm' hypervisor type
image metadata to 'phyp' for scheduling.

The powervc-driver in stackforge uses the hypervisor type of 'powervm'
for scheduling so this is needed to make that work until the driver
can get a translation shim in place to convert powervm to phyp in
image metadata.

Closes-Bug: #1370613

Change-Id: I4b20ffcb9911806db821f2902e09248dfa89d845
(cherry picked from commit d05567cc3f)
This commit is contained in:
Matt Riedemann 2014-09-17 09:47:55 -07:00 committed by Terry Yao
parent 2aeee7a807
commit 6ffc2beba9
2 changed files with 6 additions and 0 deletions

View File

@ -89,6 +89,9 @@ def canonicalize(name):
if newname == "xapi":
newname = XEN
elif newname == "powervm":
# TODO(mriedem): Remove the translation shim in the 2015.2 'L' release.
newname = PHYP
if not is_valid(newname):
raise exception.InvalidHypervisorVirtType(hvtype=name)

View File

@ -37,6 +37,9 @@ class HvTypeTest(test.NoDBTestCase):
def test_canonicalize_xapi(self):
self.assertEqual(hvtype.XEN, hvtype.canonicalize("xapi"))
def test_canonicalize_powervm(self):
self.assertEqual(hvtype.PHYP, hvtype.canonicalize("POWERVM"))
def test_canonicalize_invalid(self):
self.assertRaises(exception.InvalidHypervisorVirtType,
hvtype.canonicalize,