Merge "objects: Move 'hv_type' to 'fields.HVType'"

This commit is contained in:
Jenkins 2016-12-02 15:28:26 +00:00 committed by Gerrit Code Review
commit aad61b68bd
17 changed files with 182 additions and 219 deletions

View File

@ -1,106 +0,0 @@
# Copyright 2014 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Constants and helper APIs for dealing with virtualization types
The constants provide the standard names for all known guest
virtualization types. This is not to be confused with the Nova
hypervisor driver types, since one driver may support multiple
virtualization types and one virtualization type (eg 'xen') may
be supported by multiple drivers ('XenAPI' or 'Libvirt-Xen').
"""
from nova import exception
# This list is all known hypervisors
# even if not currently supported by OpenStack.
BAREMETAL = "baremetal"
BHYVE = "bhyve"
DOCKER = "docker"
FAKE = "fake"
HYPERV = "hyperv"
IRONIC = "ironic"
KQEMU = "kqemu"
KVM = "kvm"
LXC = "lxc"
LXD = "lxd"
OPENVZ = "openvz"
PARALLELS = "parallels"
VIRTUOZZO = "vz"
PHYP = "phyp"
QEMU = "qemu"
TEST = "test"
UML = "uml"
VBOX = "vbox"
VMWARE = "vmware"
XEN = "xen"
ZVM = "zvm"
ALL = (
BAREMETAL,
BHYVE,
DOCKER,
FAKE,
HYPERV,
IRONIC,
KQEMU,
KVM,
LXC,
LXD,
OPENVZ,
PARALLELS,
PHYP,
QEMU,
TEST,
UML,
VBOX,
VIRTUOZZO,
VMWARE,
XEN,
ZVM,
)
def is_valid(name):
"""Check if a string is a valid hypervisor type
:param name: hypervisor type name to validate
:returns: True if @name is valid
"""
return name in ALL
def canonicalize(name):
"""Canonicalize the hypervisor type name
:param name: hypervisor type name to canonicalize
:returns: a canonical hypervisor type name
"""
if name is None:
return None
newname = name.lower()
if newname == "xapi":
newname = XEN
if not is_valid(newname):
raise exception.InvalidHypervisorVirtType(hv_type=name)
return newname

View File

@ -18,8 +18,6 @@ import re
from oslo_versionedobjects import fields
import six
# TODO(berrange) Temporary import for HVType class
from nova.compute import hv_type
# TODO(berrange) Temporary import for VMMode class
from nova.compute import vm_mode
from nova import exception
@ -332,18 +330,81 @@ class FirmwareType(BaseNovaEnum):
class HVType(BaseNovaEnum):
# TODO(berrange): move all constants out of 'nova.compute.hv_type'
# into fields on this class
ALL = hv_type.ALL
"""Represents virtualization types.
Provide the standard names for all known guest virtualization
types. This is not to be confused with the Nova hypervisor driver
types, since one driver may support multiple virtualization types
and one virtualization type (eg 'xen') may be supported by multiple
drivers ('XenAPI' or 'Libvirt-Xen').
"""
BAREMETAL = 'baremetal'
BHYVE = 'bhyve'
DOCKER = 'docker'
FAKE = 'fake'
HYPERV = 'hyperv'
IRONIC = 'ironic'
KQEMU = 'kqemu'
KVM = 'kvm'
LXC = 'lxc'
LXD = 'lxd'
OPENVZ = 'openvz'
PARALLELS = 'parallels'
VIRTUOZZO = 'vz'
PHYP = 'phyp'
QEMU = 'qemu'
TEST = 'test'
UML = 'uml'
VBOX = 'vbox'
VMWARE = 'vmware'
XEN = 'xen'
ZVM = 'zvm'
ALL = (BAREMETAL, BHYVE, DOCKER, FAKE, HYPERV, IRONIC, KQEMU, KVM, LXC,
LXD, OPENVZ, PARALLELS, PHYP, QEMU, TEST, UML, VBOX, VIRTUOZZO,
VMWARE, XEN, ZVM)
def coerce(self, obj, attr, value):
try:
value = hv_type.canonicalize(value)
value = self.canonicalize(value)
except exception.InvalidHypervisorVirtType:
msg = _("Hypervisor virt type '%s' is not valid") % value
raise ValueError(msg)
return super(HVType, self).coerce(obj, attr, value)
@classmethod
def is_valid(cls, name):
"""Check if a string is a valid hypervisor type
:param name: hypervisor type name to validate
:returns: True if @name is valid
"""
return name in cls.ALL
@classmethod
def canonicalize(cls, name):
"""Canonicalize the hypervisor type name
:param name: hypervisor type name to canonicalize
:returns: a canonical hypervisor type name
"""
if name is None:
return None
newname = name.lower()
if newname == 'xapi':
newname = cls.XEN
if not cls.is_valid(newname):
raise exception.InvalidHypervisorVirtType(hv_type=name)
return newname
class ImageSignatureHashType(BaseNovaEnum):
# Represents the possible hash methods used for image signing

View File

@ -15,7 +15,6 @@
from oslo_utils import versionutils
from nova.compute import hv_type
from nova.objects import base
from nova.objects import fields
@ -48,5 +47,5 @@ class HVSpec(base.NovaObject):
super(HVSpec, self).obj_make_compatible(primitive, target_version)
target_version = versionutils.convert_version_to_tuple(target_version)
if (target_version < (1, 1) and 'hv_type' in primitive and
hv_type.VIRTUOZZO == primitive['hv_type']):
primitive['hv_type'] = hv_type.PARALLELS
fields.HVType.VIRTUOZZO == primitive['hv_type']):
primitive['hv_type'] = fields.HVType.PARALLELS

View File

@ -19,7 +19,6 @@ from distutils import versionpredicate
from oslo_log import log as logging
from oslo_utils import versionutils
from nova.compute import hv_type
from nova.compute import vm_mode
from nova.objects import fields
from nova.scheduler import filters
@ -48,7 +47,7 @@ class ImagePropertiesFilter(filters.BaseHostFilter):
img_vm_mode = image_props.get('hw_vm_mode')
checked_img_props = (
fields.Architecture.canonicalize(img_arch),
hv_type.canonicalize(img_h_type),
fields.HVType.canonicalize(img_h_type),
vm_mode.canonicalize(img_vm_mode)
)

View File

@ -21,10 +21,10 @@ This host manager will consume all cpu's, disk space, and
ram from a host / node as it is supporting Baremetal hosts, which can not be
subdivided into multiple instances.
"""
from nova.compute import hv_type
import nova.conf
from nova import context as context_module
from nova import objects
from nova.objects import fields as obj_fields
from nova.scheduler import host_manager
CONF = nova.conf.CONF
@ -78,7 +78,7 @@ class IronicHostManager(host_manager.HostManager):
@staticmethod
def _is_ironic_compute(compute):
ht = compute.hypervisor_type if 'hypervisor_type' in compute else None
return ht == hv_type.IRONIC
return ht == obj_fields.HVType.IRONIC
def _load_filters(self):
if CONF.filter_scheduler.use_baremetal_filters:

View File

@ -1,52 +0,0 @@
# Copyright (C) 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from nova.compute import hv_type
from nova import exception
from nova import test
class HvTypeTest(test.NoDBTestCase):
def test_valid_string(self):
self.assertTrue(hv_type.is_valid("vmware"))
def test_valid_constant(self):
self.assertTrue(hv_type.is_valid(hv_type.QEMU))
def test_valid_docker(self):
self.assertTrue(hv_type.is_valid("docker"))
def test_valid_lxd(self):
self.assertTrue(hv_type.is_valid("lxd"))
def test_valid_vz(self):
self.assertTrue(hv_type.is_valid(hv_type.VIRTUOZZO))
def test_valid_bogus(self):
self.assertFalse(hv_type.is_valid("acmehypervisor"))
def test_canonicalize_none(self):
self.assertIsNone(hv_type.canonicalize(None))
def test_canonicalize_case(self):
self.assertEqual(hv_type.QEMU, hv_type.canonicalize("QeMu"))
def test_canonicalize_xapi(self):
self.assertEqual(hv_type.XEN, hv_type.canonicalize("xapi"))
def test_canonicalize_invalid(self):
self.assertRaises(exception.InvalidHypervisorVirtType,
hv_type.canonicalize,
"wibble")

View File

@ -19,7 +19,6 @@ from oslo_utils import timeutils
from oslo_utils import units
from nova.compute import claims
from nova.compute import hv_type
from nova.compute.monitors import base as monitor_base
from nova.compute import power_state
from nova.compute import resource_tracker
@ -80,7 +79,7 @@ _COMPUTE_NODE_FIXTURES = [
supported_hv_specs=[
objects.HVSpec.from_list([
obj_fields.Architecture.I686,
hv_type.KVM,
obj_fields.HVType.KVM,
vm_mode.HVM])
],
metrics=None,

View File

@ -224,12 +224,49 @@ class TestArchitecture(TestField):
self.assertEqual(fields.Architecture.I686,
fields.Architecture.canonicalize('x86_32p'))
def test_canonicalize_bogus(self):
def test_canonicalize_invalid(self):
self.assertRaises(exception.InvalidArchitectureName,
fields.Architecture.canonicalize,
'x86_64wibble')
class TestHVType(TestField):
def test_valid_string(self):
self.assertTrue(fields.HVType.is_valid('vmware'))
def test_valid_constant(self):
self.assertTrue(fields.HVType.is_valid(fields.HVType.QEMU))
def test_valid_docker(self):
self.assertTrue(fields.HVType.is_valid('docker'))
def test_valid_lxd(self):
self.assertTrue(fields.HVType.is_valid('lxd'))
def test_valid_vz(self):
self.assertTrue(fields.HVType.is_valid(
fields.HVType.VIRTUOZZO))
def test_valid_bogus(self):
self.assertFalse(fields.HVType.is_valid('acmehypervisor'))
def test_canonicalize_none(self):
self.assertIsNone(fields.HVType.canonicalize(None))
def test_canonicalize_case(self):
self.assertEqual(fields.HVType.QEMU,
fields.HVType.canonicalize('QeMu'))
def test_canonicalize_xapi(self):
self.assertEqual(fields.HVType.XEN,
fields.HVType.canonicalize('xapi'))
def test_canonicalize_invalid(self):
self.assertRaises(exception.InvalidHypervisorVirtType,
fields.HVType.canonicalize,
'wibble')
class TestImageSignatureTypes(TestField):
# Ensure that the object definition is updated
# in step with the signature_utils module

View File

@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova.compute import hv_type
from nova.compute import vm_mode
from nova import objects
from nova.objects import fields as obj_fields
@ -22,25 +21,25 @@ from nova.tests.unit.objects import test_objects
spec_dict = {
'arch': obj_fields.Architecture.I686,
'hv_type': hv_type.KVM,
'hv_type': obj_fields.HVType.KVM,
'vm_mode': vm_mode.HVM
}
spec_list = [
obj_fields.Architecture.I686,
hv_type.KVM,
obj_fields.HVType.KVM,
vm_mode.HVM
]
spec_dict_vz = {
'arch': obj_fields.Architecture.I686,
'hv_type': hv_type.VIRTUOZZO,
'hv_type': obj_fields.HVType.VIRTUOZZO,
'vm_mode': vm_mode.HVM
}
spec_dict_parallels = {
'arch': obj_fields.Architecture.I686,
'hv_type': hv_type.PARALLELS,
'hv_type': obj_fields.HVType.PARALLELS,
'vm_mode': vm_mode.HVM
}
@ -54,7 +53,7 @@ class _TestHVSpecObject(object):
def test_hv_spec_to_list(self):
spec_obj = objects.HVSpec()
spec_obj.arch = obj_fields.Architecture.I686
spec_obj.hv_type = hv_type.KVM
spec_obj.hv_type = obj_fields.HVType.KVM
spec_obj.vm_mode = vm_mode.HVM
spec = spec_obj.to_list()
self.assertEqual(spec_list, spec)

View File

@ -12,7 +12,6 @@
from oslo_utils import versionutils
from nova.compute import hv_type
from nova.compute import vm_mode
from nova import objects
from nova.objects import fields as obj_fields
@ -31,14 +30,16 @@ class TestImagePropsFilter(test.NoDBTestCase):
img_props = objects.ImageMeta(
properties=objects.ImageMetaProps(
hw_architecture=obj_fields.Architecture.X86_64,
img_hv_type=hv_type.KVM,
img_hv_type=obj_fields.HVType.KVM,
hw_vm_mode=vm_mode.HVM,
img_hv_requested_version='>=6.0,<6.2'))
spec_obj = objects.RequestSpec(image=img_props)
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
capabilities = {
'supported_instances': [(
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)],
obj_fields.Architecture.X86_64,
obj_fields.HVType.KVM,
vm_mode.HVM)],
'hypervisor_version': hypervisor_version}
host = fakes.FakeHostState('host1', 'node1', capabilities)
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
@ -47,13 +48,15 @@ class TestImagePropsFilter(test.NoDBTestCase):
img_props = objects.ImageMeta(
properties=objects.ImageMetaProps(
hw_architecture=obj_fields.Architecture.ARMV7,
img_hv_type=hv_type.QEMU,
img_hv_type=obj_fields.HVType.QEMU,
hw_vm_mode=vm_mode.HVM))
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
spec_obj = objects.RequestSpec(image=img_props)
capabilities = {
'supported_instances': [(
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)],
obj_fields.Architecture.X86_64,
obj_fields.HVType.KVM,
vm_mode.HVM)],
'hypervisor_version': hypervisor_version}
host = fakes.FakeHostState('host1', 'node1', capabilities)
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
@ -62,7 +65,7 @@ class TestImagePropsFilter(test.NoDBTestCase):
img_props = objects.ImageMeta(
properties=objects.ImageMetaProps(
hw_architecture=obj_fields.Architecture.X86_64,
img_hv_type=hv_type.KVM,
img_hv_type=obj_fields.HVType.KVM,
hw_vm_mode=vm_mode.HVM,
img_hv_requested_version='>=6.2'))
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
@ -70,7 +73,9 @@ class TestImagePropsFilter(test.NoDBTestCase):
capabilities = {
'enabled': True,
'supported_instances': [(
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)],
obj_fields.Architecture.X86_64,
obj_fields.HVType.KVM,
vm_mode.HVM)],
'hypervisor_version': hypervisor_version}
host = fakes.FakeHostState('host1', 'node1', capabilities)
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
@ -84,7 +89,9 @@ class TestImagePropsFilter(test.NoDBTestCase):
spec_obj = objects.RequestSpec(image=img_props)
capabilities = {
'supported_instances': [(
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)],
obj_fields.Architecture.X86_64,
obj_fields.HVType.KVM,
vm_mode.HVM)],
'hypervisor_version': hypervisor_version}
host = fakes.FakeHostState('host1', 'node1', capabilities)
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
@ -98,7 +105,9 @@ class TestImagePropsFilter(test.NoDBTestCase):
spec_obj = objects.RequestSpec(image=img_props)
capabilities = {
'supported_instances': [(
obj_fields.Architecture.X86_64, hv_type.XEN, vm_mode.XEN)],
obj_fields.Architecture.X86_64,
obj_fields.HVType.XEN,
vm_mode.XEN)],
'hypervisor_version': hypervisor_version}
host = fakes.FakeHostState('host1', 'node1', capabilities)
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
@ -108,7 +117,9 @@ class TestImagePropsFilter(test.NoDBTestCase):
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
capabilities = {
'supported_instances': [(
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)],
obj_fields.Architecture.X86_64,
obj_fields.HVType.KVM,
vm_mode.HVM)],
'hypervisor_version': hypervisor_version}
host = fakes.FakeHostState('host1', 'node1', capabilities)
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
@ -117,7 +128,7 @@ class TestImagePropsFilter(test.NoDBTestCase):
img_props = objects.ImageMeta(
properties=objects.ImageMetaProps(
hw_architecture=obj_fields.Architecture.X86_64,
img_hv_type=hv_type.KVM,
img_hv_type=obj_fields.HVType.KVM,
hw_vm_mode=vm_mode.HVM))
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
spec_obj = objects.RequestSpec(image=img_props)
@ -131,14 +142,16 @@ class TestImagePropsFilter(test.NoDBTestCase):
img_props = objects.ImageMeta(
properties=objects.ImageMetaProps(
hw_architecture=obj_fields.Architecture.X86_64,
img_hv_type=hv_type.KVM,
img_hv_type=obj_fields.HVType.KVM,
hw_vm_mode=vm_mode.HVM,
img_hv_requested_version='>=6.0'))
spec_obj = objects.RequestSpec(image=img_props)
capabilities = {
'enabled': True,
'supported_instances': [(
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)]}
obj_fields.Architecture.X86_64,
obj_fields.HVType.KVM,
vm_mode.HVM)]}
host = fakes.FakeHostState('host1', 'node1', capabilities)
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
@ -146,14 +159,16 @@ class TestImagePropsFilter(test.NoDBTestCase):
img_props = objects.ImageMeta(
properties=objects.ImageMetaProps(
hw_architecture=obj_fields.Architecture.X86_64,
img_hv_type=hv_type.KVM,
img_hv_type=obj_fields.HVType.KVM,
hw_vm_mode=vm_mode.HVM,
img_hv_requested_version='>=6.0'))
spec_obj = objects.RequestSpec(image=img_props)
capabilities = {
'enabled': True,
'supported_instances': [(
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)],
obj_fields.Architecture.X86_64,
obj_fields.HVType.KVM,
vm_mode.HVM)],
'hypervisor_version': 5000}
host = fakes.FakeHostState('host1', 'node1', capabilities)
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
@ -167,7 +182,9 @@ class TestImagePropsFilter(test.NoDBTestCase):
spec_obj = objects.RequestSpec(image=img_props)
capabilities = {
'supported_instances': [(
obj_fields.Architecture.X86_64, hv_type.XEN, vm_mode.XEN)],
obj_fields.Architecture.X86_64,
obj_fields.HVType.XEN,
vm_mode.XEN)],
'hypervisor_version': hypervisor_version}
host = fakes.FakeHostState('host1', 'node1', capabilities)
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
@ -181,7 +198,9 @@ class TestImagePropsFilter(test.NoDBTestCase):
spec_obj = objects.RequestSpec(image=img_props)
capabilities = {
'supported_instances': [(
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)],
obj_fields.Architecture.X86_64,
obj_fields.HVType.KVM,
vm_mode.HVM)],
'hypervisor_version': hypervisor_version}
host = fakes.FakeHostState('host1', 'node1', capabilities)
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
@ -195,7 +214,9 @@ class TestImagePropsFilter(test.NoDBTestCase):
spec_obj = objects.RequestSpec(image=img_props)
capabilities = {
'supported_instances': [(
obj_fields.Architecture.I686, hv_type.KVM, vm_mode.HVM)],
obj_fields.Architecture.I686,
obj_fields.HVType.KVM,
vm_mode.HVM)],
'hypervisor_version': hypervisor_version}
host = fakes.FakeHostState('host1', 'node1', capabilities)
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
@ -209,7 +230,9 @@ class TestImagePropsFilter(test.NoDBTestCase):
spec_obj = objects.RequestSpec(image=img_props)
capabilities = {
'supported_instances': [(
obj_fields.Architecture.I686, hv_type.XEN, vm_mode.HVM)],
obj_fields.Architecture.I686,
obj_fields.HVType.XEN,
vm_mode.HVM)],
'hypervisor_version': hypervisor_version}
host = fakes.FakeHostState('host1', 'node1', capabilities)
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
@ -224,7 +247,9 @@ class TestImagePropsFilter(test.NoDBTestCase):
spec_obj = objects.RequestSpec(image=img_props)
capabilities = {
'supported_instances': [(
obj_fields.Architecture.I686, hv_type.BAREMETAL, vm_mode.HVM)],
obj_fields.Architecture.I686,
obj_fields.HVType.BAREMETAL,
vm_mode.HVM)],
'hypervisor_version': hypervisor_version}
host = fakes.FakeHostState('host1', 'node1', capabilities)
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))

View File

@ -34,7 +34,6 @@ import six
import testtools
from nova.compute import api as compute_api
from nova.compute import hv_type
from nova.compute import power_state
from nova.compute import task_states
from nova.compute import utils as compute_utils
@ -2277,19 +2276,19 @@ class ToSupportedInstancesTestCase(test.NoDBTestCase):
def test_return_value(self):
self.assertEqual(
[(obj_fields.Architecture.X86_64, hv_type.XEN, 'xen')],
[(obj_fields.Architecture.X86_64, obj_fields.HVType.XEN, 'xen')],
host.to_supported_instances([u'xen-3.0-x86_64']))
def test_invalid_values_do_not_break(self):
self.assertEqual(
[(obj_fields.Architecture.X86_64, hv_type.XEN, 'xen')],
[(obj_fields.Architecture.X86_64, obj_fields.HVType.XEN, 'xen')],
host.to_supported_instances([u'xen-3.0-x86_64', 'spam']))
def test_multiple_values(self):
self.assertEqual(
[
(obj_fields.Architecture.X86_64, hv_type.XEN, 'xen'),
(obj_fields.Architecture.I686, hv_type.XEN, 'hvm')
(obj_fields.Architecture.X86_64, obj_fields.HVType.XEN, 'xen'),
(obj_fields.Architecture.I686, obj_fields.HVType.XEN, 'hvm')
],
host.to_supported_instances([u'xen-3.0-x86_64', 'hvm-3.0-x86_32'])
)

View File

@ -30,7 +30,6 @@ from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import versionutils
from nova.compute import hv_type
from nova.compute import power_state
from nova.compute import task_states
from nova.compute import vm_mode
@ -148,7 +147,9 @@ class FakeDriver(driver.ComputeDriver):
'cpu_info': {},
'disk_available_least': 0,
'supported_instances': [(
obj_fields.Architecture.X86_64, hv_type.FAKE, vm_mode.HVM)],
obj_fields.Architecture.X86_64,
obj_fields.HVType.FAKE,
vm_mode.HVM)],
'numa_topology': None,
}
self._mounts = {}

View File

@ -26,7 +26,6 @@ from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import units
from nova.compute import hv_type
from nova.compute import vm_mode
import nova.conf
from nova.i18n import _
@ -158,8 +157,11 @@ class HostOps(object):
'vcpus_used': 0,
'cpu_info': jsonutils.dumps(cpu_info),
'supported_instances': [
(obj_fields.Architecture.I686, hv_type.HYPERV, vm_mode.HVM),
(obj_fields.Architecture.X86_64, hv_type.HYPERV,
(obj_fields.Architecture.I686,
obj_fields.HVType.HYPERV,
vm_mode.HVM),
(obj_fields.Architecture.X86_64,
obj_fields.HVType.HYPERV,
vm_mode.HVM)],
'numa_topology': None,
}

View File

@ -34,7 +34,6 @@ import six
import six.moves.urllib.parse as urlparse
from nova.api.metadata import base as instance_metadata
from nova.compute import hv_type
from nova.compute import power_state
from nova.compute import task_states
from nova.compute import vm_mode
@ -98,7 +97,7 @@ def _get_nodes_supported_instances(cpu_arch=None):
if not cpu_arch:
return []
return [(cpu_arch,
hv_type.BAREMETAL,
obj_fields.HVType.BAREMETAL,
vm_mode.HVM)]

View File

@ -61,7 +61,6 @@ from six.moves import range
from nova.api.metadata import base as instance_metadata
from nova import block_device
from nova.compute import hv_type
from nova.compute import power_state
from nova.compute import task_states
from nova.compute import utils as compute_utils
@ -5072,7 +5071,7 @@ class LibvirtDriver(driver.ComputeDriver):
for dt in g.domtype:
instance_cap = (
fields.Architecture.canonicalize(g.arch),
hv_type.canonicalize(dt),
fields.HVType.canonicalize(dt),
vm_mode.canonicalize(g.ostype))
instance_caps.append(instance_cap)

View File

@ -22,7 +22,6 @@ from oslo_utils import units
from oslo_utils import versionutils
from oslo_vmware import exceptions as vexc
from nova.compute import hv_type
from nova.compute import vm_mode
import nova.conf
from nova import context
@ -98,8 +97,12 @@ class VCState(object):
str(about_info.version))
data["hypervisor_hostname"] = self._host_name
data["supported_instances"] = [
(obj_fields.Architecture.I686, hv_type.VMWARE, vm_mode.HVM),
(obj_fields.Architecture.X86_64, hv_type.VMWARE, vm_mode.HVM)]
(obj_fields.Architecture.I686,
obj_fields.HVType.VMWARE,
vm_mode.HVM),
(obj_fields.Architecture.X86_64,
obj_fields.HVType.VMWARE,
vm_mode.HVM)]
self._stats = data
if self._auto_service_disabled:

View File

@ -24,7 +24,6 @@ from oslo_log import log as logging
from oslo_serialization import jsonutils
import six
from nova.compute import hv_type
from nova.compute import task_states
from nova.compute import vm_mode
from nova.compute import vm_states
@ -288,7 +287,7 @@ def to_supported_instances(host_capabilities):
guestarch = obj_fields.Architecture.canonicalize(guestarch)
ostype = vm_mode.canonicalize(ostype)
result.append((guestarch, hv_type.XEN, ostype))
result.append((guestarch, obj_fields.HVType.XEN, ostype))
except ValueError:
LOG.warning(_LW("Failed to extract instance support from %s"),
capability)