Merge "objects: Move 'hv_type' to 'fields.HVType'"
This commit is contained in:
commit
aad61b68bd
|
@ -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
|
|
|
@ -18,8 +18,6 @@ import re
|
||||||
from oslo_versionedobjects import fields
|
from oslo_versionedobjects import fields
|
||||||
import six
|
import six
|
||||||
|
|
||||||
# TODO(berrange) Temporary import for HVType class
|
|
||||||
from nova.compute import hv_type
|
|
||||||
# TODO(berrange) Temporary import for VMMode class
|
# TODO(berrange) Temporary import for VMMode class
|
||||||
from nova.compute import vm_mode
|
from nova.compute import vm_mode
|
||||||
from nova import exception
|
from nova import exception
|
||||||
|
@ -332,18 +330,81 @@ class FirmwareType(BaseNovaEnum):
|
||||||
|
|
||||||
|
|
||||||
class HVType(BaseNovaEnum):
|
class HVType(BaseNovaEnum):
|
||||||
# TODO(berrange): move all constants out of 'nova.compute.hv_type'
|
"""Represents virtualization types.
|
||||||
# into fields on this class
|
|
||||||
ALL = hv_type.ALL
|
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):
|
def coerce(self, obj, attr, value):
|
||||||
try:
|
try:
|
||||||
value = hv_type.canonicalize(value)
|
value = self.canonicalize(value)
|
||||||
except exception.InvalidHypervisorVirtType:
|
except exception.InvalidHypervisorVirtType:
|
||||||
msg = _("Hypervisor virt type '%s' is not valid") % value
|
msg = _("Hypervisor virt type '%s' is not valid") % value
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
|
|
||||||
return super(HVType, self).coerce(obj, attr, value)
|
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):
|
class ImageSignatureHashType(BaseNovaEnum):
|
||||||
# Represents the possible hash methods used for image signing
|
# Represents the possible hash methods used for image signing
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
|
|
||||||
from oslo_utils import versionutils
|
from oslo_utils import versionutils
|
||||||
|
|
||||||
from nova.compute import hv_type
|
|
||||||
from nova.objects import base
|
from nova.objects import base
|
||||||
from nova.objects import fields
|
from nova.objects import fields
|
||||||
|
|
||||||
|
@ -48,5 +47,5 @@ class HVSpec(base.NovaObject):
|
||||||
super(HVSpec, self).obj_make_compatible(primitive, target_version)
|
super(HVSpec, self).obj_make_compatible(primitive, target_version)
|
||||||
target_version = versionutils.convert_version_to_tuple(target_version)
|
target_version = versionutils.convert_version_to_tuple(target_version)
|
||||||
if (target_version < (1, 1) and 'hv_type' in primitive and
|
if (target_version < (1, 1) and 'hv_type' in primitive and
|
||||||
hv_type.VIRTUOZZO == primitive['hv_type']):
|
fields.HVType.VIRTUOZZO == primitive['hv_type']):
|
||||||
primitive['hv_type'] = hv_type.PARALLELS
|
primitive['hv_type'] = fields.HVType.PARALLELS
|
||||||
|
|
|
@ -19,7 +19,6 @@ from distutils import versionpredicate
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import versionutils
|
from oslo_utils import versionutils
|
||||||
|
|
||||||
from nova.compute import hv_type
|
|
||||||
from nova.compute import vm_mode
|
from nova.compute import vm_mode
|
||||||
from nova.objects import fields
|
from nova.objects import fields
|
||||||
from nova.scheduler import filters
|
from nova.scheduler import filters
|
||||||
|
@ -48,7 +47,7 @@ class ImagePropertiesFilter(filters.BaseHostFilter):
|
||||||
img_vm_mode = image_props.get('hw_vm_mode')
|
img_vm_mode = image_props.get('hw_vm_mode')
|
||||||
checked_img_props = (
|
checked_img_props = (
|
||||||
fields.Architecture.canonicalize(img_arch),
|
fields.Architecture.canonicalize(img_arch),
|
||||||
hv_type.canonicalize(img_h_type),
|
fields.HVType.canonicalize(img_h_type),
|
||||||
vm_mode.canonicalize(img_vm_mode)
|
vm_mode.canonicalize(img_vm_mode)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -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
|
ram from a host / node as it is supporting Baremetal hosts, which can not be
|
||||||
subdivided into multiple instances.
|
subdivided into multiple instances.
|
||||||
"""
|
"""
|
||||||
from nova.compute import hv_type
|
|
||||||
import nova.conf
|
import nova.conf
|
||||||
from nova import context as context_module
|
from nova import context as context_module
|
||||||
from nova import objects
|
from nova import objects
|
||||||
|
from nova.objects import fields as obj_fields
|
||||||
from nova.scheduler import host_manager
|
from nova.scheduler import host_manager
|
||||||
|
|
||||||
CONF = nova.conf.CONF
|
CONF = nova.conf.CONF
|
||||||
|
@ -78,7 +78,7 @@ class IronicHostManager(host_manager.HostManager):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _is_ironic_compute(compute):
|
def _is_ironic_compute(compute):
|
||||||
ht = compute.hypervisor_type if 'hypervisor_type' in compute else None
|
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):
|
def _load_filters(self):
|
||||||
if CONF.filter_scheduler.use_baremetal_filters:
|
if CONF.filter_scheduler.use_baremetal_filters:
|
||||||
|
|
|
@ -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")
|
|
|
@ -19,7 +19,6 @@ from oslo_utils import timeutils
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
|
|
||||||
from nova.compute import claims
|
from nova.compute import claims
|
||||||
from nova.compute import hv_type
|
|
||||||
from nova.compute.monitors import base as monitor_base
|
from nova.compute.monitors import base as monitor_base
|
||||||
from nova.compute import power_state
|
from nova.compute import power_state
|
||||||
from nova.compute import resource_tracker
|
from nova.compute import resource_tracker
|
||||||
|
@ -80,7 +79,7 @@ _COMPUTE_NODE_FIXTURES = [
|
||||||
supported_hv_specs=[
|
supported_hv_specs=[
|
||||||
objects.HVSpec.from_list([
|
objects.HVSpec.from_list([
|
||||||
obj_fields.Architecture.I686,
|
obj_fields.Architecture.I686,
|
||||||
hv_type.KVM,
|
obj_fields.HVType.KVM,
|
||||||
vm_mode.HVM])
|
vm_mode.HVM])
|
||||||
],
|
],
|
||||||
metrics=None,
|
metrics=None,
|
||||||
|
|
|
@ -224,12 +224,49 @@ class TestArchitecture(TestField):
|
||||||
self.assertEqual(fields.Architecture.I686,
|
self.assertEqual(fields.Architecture.I686,
|
||||||
fields.Architecture.canonicalize('x86_32p'))
|
fields.Architecture.canonicalize('x86_32p'))
|
||||||
|
|
||||||
def test_canonicalize_bogus(self):
|
def test_canonicalize_invalid(self):
|
||||||
self.assertRaises(exception.InvalidArchitectureName,
|
self.assertRaises(exception.InvalidArchitectureName,
|
||||||
fields.Architecture.canonicalize,
|
fields.Architecture.canonicalize,
|
||||||
'x86_64wibble')
|
'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):
|
class TestImageSignatureTypes(TestField):
|
||||||
# Ensure that the object definition is updated
|
# Ensure that the object definition is updated
|
||||||
# in step with the signature_utils module
|
# in step with the signature_utils module
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from nova.compute import hv_type
|
|
||||||
from nova.compute import vm_mode
|
from nova.compute import vm_mode
|
||||||
from nova import objects
|
from nova import objects
|
||||||
from nova.objects import fields as obj_fields
|
from nova.objects import fields as obj_fields
|
||||||
|
@ -22,25 +21,25 @@ from nova.tests.unit.objects import test_objects
|
||||||
|
|
||||||
spec_dict = {
|
spec_dict = {
|
||||||
'arch': obj_fields.Architecture.I686,
|
'arch': obj_fields.Architecture.I686,
|
||||||
'hv_type': hv_type.KVM,
|
'hv_type': obj_fields.HVType.KVM,
|
||||||
'vm_mode': vm_mode.HVM
|
'vm_mode': vm_mode.HVM
|
||||||
}
|
}
|
||||||
|
|
||||||
spec_list = [
|
spec_list = [
|
||||||
obj_fields.Architecture.I686,
|
obj_fields.Architecture.I686,
|
||||||
hv_type.KVM,
|
obj_fields.HVType.KVM,
|
||||||
vm_mode.HVM
|
vm_mode.HVM
|
||||||
]
|
]
|
||||||
|
|
||||||
spec_dict_vz = {
|
spec_dict_vz = {
|
||||||
'arch': obj_fields.Architecture.I686,
|
'arch': obj_fields.Architecture.I686,
|
||||||
'hv_type': hv_type.VIRTUOZZO,
|
'hv_type': obj_fields.HVType.VIRTUOZZO,
|
||||||
'vm_mode': vm_mode.HVM
|
'vm_mode': vm_mode.HVM
|
||||||
}
|
}
|
||||||
|
|
||||||
spec_dict_parallels = {
|
spec_dict_parallels = {
|
||||||
'arch': obj_fields.Architecture.I686,
|
'arch': obj_fields.Architecture.I686,
|
||||||
'hv_type': hv_type.PARALLELS,
|
'hv_type': obj_fields.HVType.PARALLELS,
|
||||||
'vm_mode': vm_mode.HVM
|
'vm_mode': vm_mode.HVM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +53,7 @@ class _TestHVSpecObject(object):
|
||||||
def test_hv_spec_to_list(self):
|
def test_hv_spec_to_list(self):
|
||||||
spec_obj = objects.HVSpec()
|
spec_obj = objects.HVSpec()
|
||||||
spec_obj.arch = obj_fields.Architecture.I686
|
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_obj.vm_mode = vm_mode.HVM
|
||||||
spec = spec_obj.to_list()
|
spec = spec_obj.to_list()
|
||||||
self.assertEqual(spec_list, spec)
|
self.assertEqual(spec_list, spec)
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
|
|
||||||
from oslo_utils import versionutils
|
from oslo_utils import versionutils
|
||||||
|
|
||||||
from nova.compute import hv_type
|
|
||||||
from nova.compute import vm_mode
|
from nova.compute import vm_mode
|
||||||
from nova import objects
|
from nova import objects
|
||||||
from nova.objects import fields as obj_fields
|
from nova.objects import fields as obj_fields
|
||||||
|
@ -31,14 +30,16 @@ class TestImagePropsFilter(test.NoDBTestCase):
|
||||||
img_props = objects.ImageMeta(
|
img_props = objects.ImageMeta(
|
||||||
properties=objects.ImageMetaProps(
|
properties=objects.ImageMetaProps(
|
||||||
hw_architecture=obj_fields.Architecture.X86_64,
|
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,
|
hw_vm_mode=vm_mode.HVM,
|
||||||
img_hv_requested_version='>=6.0,<6.2'))
|
img_hv_requested_version='>=6.0,<6.2'))
|
||||||
spec_obj = objects.RequestSpec(image=img_props)
|
spec_obj = objects.RequestSpec(image=img_props)
|
||||||
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
||||||
capabilities = {
|
capabilities = {
|
||||||
'supported_instances': [(
|
'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}
|
'hypervisor_version': hypervisor_version}
|
||||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
||||||
|
@ -47,13 +48,15 @@ class TestImagePropsFilter(test.NoDBTestCase):
|
||||||
img_props = objects.ImageMeta(
|
img_props = objects.ImageMeta(
|
||||||
properties=objects.ImageMetaProps(
|
properties=objects.ImageMetaProps(
|
||||||
hw_architecture=obj_fields.Architecture.ARMV7,
|
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))
|
hw_vm_mode=vm_mode.HVM))
|
||||||
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
||||||
spec_obj = objects.RequestSpec(image=img_props)
|
spec_obj = objects.RequestSpec(image=img_props)
|
||||||
capabilities = {
|
capabilities = {
|
||||||
'supported_instances': [(
|
'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}
|
'hypervisor_version': hypervisor_version}
|
||||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||||
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
|
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
|
||||||
|
@ -62,7 +65,7 @@ class TestImagePropsFilter(test.NoDBTestCase):
|
||||||
img_props = objects.ImageMeta(
|
img_props = objects.ImageMeta(
|
||||||
properties=objects.ImageMetaProps(
|
properties=objects.ImageMetaProps(
|
||||||
hw_architecture=obj_fields.Architecture.X86_64,
|
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,
|
hw_vm_mode=vm_mode.HVM,
|
||||||
img_hv_requested_version='>=6.2'))
|
img_hv_requested_version='>=6.2'))
|
||||||
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
||||||
|
@ -70,7 +73,9 @@ class TestImagePropsFilter(test.NoDBTestCase):
|
||||||
capabilities = {
|
capabilities = {
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
'supported_instances': [(
|
'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}
|
'hypervisor_version': hypervisor_version}
|
||||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||||
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
|
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)
|
spec_obj = objects.RequestSpec(image=img_props)
|
||||||
capabilities = {
|
capabilities = {
|
||||||
'supported_instances': [(
|
'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}
|
'hypervisor_version': hypervisor_version}
|
||||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
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)
|
spec_obj = objects.RequestSpec(image=img_props)
|
||||||
capabilities = {
|
capabilities = {
|
||||||
'supported_instances': [(
|
'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}
|
'hypervisor_version': hypervisor_version}
|
||||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||||
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
|
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')
|
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
||||||
capabilities = {
|
capabilities = {
|
||||||
'supported_instances': [(
|
'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}
|
'hypervisor_version': hypervisor_version}
|
||||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
||||||
|
@ -117,7 +128,7 @@ class TestImagePropsFilter(test.NoDBTestCase):
|
||||||
img_props = objects.ImageMeta(
|
img_props = objects.ImageMeta(
|
||||||
properties=objects.ImageMetaProps(
|
properties=objects.ImageMetaProps(
|
||||||
hw_architecture=obj_fields.Architecture.X86_64,
|
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))
|
hw_vm_mode=vm_mode.HVM))
|
||||||
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
||||||
spec_obj = objects.RequestSpec(image=img_props)
|
spec_obj = objects.RequestSpec(image=img_props)
|
||||||
|
@ -131,14 +142,16 @@ class TestImagePropsFilter(test.NoDBTestCase):
|
||||||
img_props = objects.ImageMeta(
|
img_props = objects.ImageMeta(
|
||||||
properties=objects.ImageMetaProps(
|
properties=objects.ImageMetaProps(
|
||||||
hw_architecture=obj_fields.Architecture.X86_64,
|
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,
|
hw_vm_mode=vm_mode.HVM,
|
||||||
img_hv_requested_version='>=6.0'))
|
img_hv_requested_version='>=6.0'))
|
||||||
spec_obj = objects.RequestSpec(image=img_props)
|
spec_obj = objects.RequestSpec(image=img_props)
|
||||||
capabilities = {
|
capabilities = {
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
'supported_instances': [(
|
'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)
|
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
||||||
|
|
||||||
|
@ -146,14 +159,16 @@ class TestImagePropsFilter(test.NoDBTestCase):
|
||||||
img_props = objects.ImageMeta(
|
img_props = objects.ImageMeta(
|
||||||
properties=objects.ImageMetaProps(
|
properties=objects.ImageMetaProps(
|
||||||
hw_architecture=obj_fields.Architecture.X86_64,
|
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,
|
hw_vm_mode=vm_mode.HVM,
|
||||||
img_hv_requested_version='>=6.0'))
|
img_hv_requested_version='>=6.0'))
|
||||||
spec_obj = objects.RequestSpec(image=img_props)
|
spec_obj = objects.RequestSpec(image=img_props)
|
||||||
capabilities = {
|
capabilities = {
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
'supported_instances': [(
|
'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}
|
'hypervisor_version': 5000}
|
||||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||||
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
|
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)
|
spec_obj = objects.RequestSpec(image=img_props)
|
||||||
capabilities = {
|
capabilities = {
|
||||||
'supported_instances': [(
|
'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}
|
'hypervisor_version': hypervisor_version}
|
||||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
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)
|
spec_obj = objects.RequestSpec(image=img_props)
|
||||||
capabilities = {
|
capabilities = {
|
||||||
'supported_instances': [(
|
'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}
|
'hypervisor_version': hypervisor_version}
|
||||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
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)
|
spec_obj = objects.RequestSpec(image=img_props)
|
||||||
capabilities = {
|
capabilities = {
|
||||||
'supported_instances': [(
|
'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}
|
'hypervisor_version': hypervisor_version}
|
||||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
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)
|
spec_obj = objects.RequestSpec(image=img_props)
|
||||||
capabilities = {
|
capabilities = {
|
||||||
'supported_instances': [(
|
'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}
|
'hypervisor_version': hypervisor_version}
|
||||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
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)
|
spec_obj = objects.RequestSpec(image=img_props)
|
||||||
capabilities = {
|
capabilities = {
|
||||||
'supported_instances': [(
|
'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}
|
'hypervisor_version': hypervisor_version}
|
||||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
||||||
|
|
|
@ -34,7 +34,6 @@ import six
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from nova.compute import api as compute_api
|
from nova.compute import api as compute_api
|
||||||
from nova.compute import hv_type
|
|
||||||
from nova.compute import power_state
|
from nova.compute import power_state
|
||||||
from nova.compute import task_states
|
from nova.compute import task_states
|
||||||
from nova.compute import utils as compute_utils
|
from nova.compute import utils as compute_utils
|
||||||
|
@ -2277,19 +2276,19 @@ class ToSupportedInstancesTestCase(test.NoDBTestCase):
|
||||||
|
|
||||||
def test_return_value(self):
|
def test_return_value(self):
|
||||||
self.assertEqual(
|
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']))
|
host.to_supported_instances([u'xen-3.0-x86_64']))
|
||||||
|
|
||||||
def test_invalid_values_do_not_break(self):
|
def test_invalid_values_do_not_break(self):
|
||||||
self.assertEqual(
|
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']))
|
host.to_supported_instances([u'xen-3.0-x86_64', 'spam']))
|
||||||
|
|
||||||
def test_multiple_values(self):
|
def test_multiple_values(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[
|
[
|
||||||
(obj_fields.Architecture.X86_64, hv_type.XEN, 'xen'),
|
(obj_fields.Architecture.X86_64, obj_fields.HVType.XEN, 'xen'),
|
||||||
(obj_fields.Architecture.I686, hv_type.XEN, 'hvm')
|
(obj_fields.Architecture.I686, obj_fields.HVType.XEN, 'hvm')
|
||||||
],
|
],
|
||||||
host.to_supported_instances([u'xen-3.0-x86_64', 'hvm-3.0-x86_32'])
|
host.to_supported_instances([u'xen-3.0-x86_64', 'hvm-3.0-x86_32'])
|
||||||
)
|
)
|
||||||
|
|
|
@ -30,7 +30,6 @@ from oslo_log import log as logging
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
from oslo_utils import versionutils
|
from oslo_utils import versionutils
|
||||||
|
|
||||||
from nova.compute import hv_type
|
|
||||||
from nova.compute import power_state
|
from nova.compute import power_state
|
||||||
from nova.compute import task_states
|
from nova.compute import task_states
|
||||||
from nova.compute import vm_mode
|
from nova.compute import vm_mode
|
||||||
|
@ -148,7 +147,9 @@ class FakeDriver(driver.ComputeDriver):
|
||||||
'cpu_info': {},
|
'cpu_info': {},
|
||||||
'disk_available_least': 0,
|
'disk_available_least': 0,
|
||||||
'supported_instances': [(
|
'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,
|
'numa_topology': None,
|
||||||
}
|
}
|
||||||
self._mounts = {}
|
self._mounts = {}
|
||||||
|
|
|
@ -26,7 +26,6 @@ from oslo_log import log as logging
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
|
|
||||||
from nova.compute import hv_type
|
|
||||||
from nova.compute import vm_mode
|
from nova.compute import vm_mode
|
||||||
import nova.conf
|
import nova.conf
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
|
@ -158,8 +157,11 @@ class HostOps(object):
|
||||||
'vcpus_used': 0,
|
'vcpus_used': 0,
|
||||||
'cpu_info': jsonutils.dumps(cpu_info),
|
'cpu_info': jsonutils.dumps(cpu_info),
|
||||||
'supported_instances': [
|
'supported_instances': [
|
||||||
(obj_fields.Architecture.I686, hv_type.HYPERV, vm_mode.HVM),
|
(obj_fields.Architecture.I686,
|
||||||
(obj_fields.Architecture.X86_64, hv_type.HYPERV,
|
obj_fields.HVType.HYPERV,
|
||||||
|
vm_mode.HVM),
|
||||||
|
(obj_fields.Architecture.X86_64,
|
||||||
|
obj_fields.HVType.HYPERV,
|
||||||
vm_mode.HVM)],
|
vm_mode.HVM)],
|
||||||
'numa_topology': None,
|
'numa_topology': None,
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ import six
|
||||||
import six.moves.urllib.parse as urlparse
|
import six.moves.urllib.parse as urlparse
|
||||||
|
|
||||||
from nova.api.metadata import base as instance_metadata
|
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 power_state
|
||||||
from nova.compute import task_states
|
from nova.compute import task_states
|
||||||
from nova.compute import vm_mode
|
from nova.compute import vm_mode
|
||||||
|
@ -98,7 +97,7 @@ def _get_nodes_supported_instances(cpu_arch=None):
|
||||||
if not cpu_arch:
|
if not cpu_arch:
|
||||||
return []
|
return []
|
||||||
return [(cpu_arch,
|
return [(cpu_arch,
|
||||||
hv_type.BAREMETAL,
|
obj_fields.HVType.BAREMETAL,
|
||||||
vm_mode.HVM)]
|
vm_mode.HVM)]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ from six.moves import range
|
||||||
|
|
||||||
from nova.api.metadata import base as instance_metadata
|
from nova.api.metadata import base as instance_metadata
|
||||||
from nova import block_device
|
from nova import block_device
|
||||||
from nova.compute import hv_type
|
|
||||||
from nova.compute import power_state
|
from nova.compute import power_state
|
||||||
from nova.compute import task_states
|
from nova.compute import task_states
|
||||||
from nova.compute import utils as compute_utils
|
from nova.compute import utils as compute_utils
|
||||||
|
@ -5072,7 +5071,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||||
for dt in g.domtype:
|
for dt in g.domtype:
|
||||||
instance_cap = (
|
instance_cap = (
|
||||||
fields.Architecture.canonicalize(g.arch),
|
fields.Architecture.canonicalize(g.arch),
|
||||||
hv_type.canonicalize(dt),
|
fields.HVType.canonicalize(dt),
|
||||||
vm_mode.canonicalize(g.ostype))
|
vm_mode.canonicalize(g.ostype))
|
||||||
instance_caps.append(instance_cap)
|
instance_caps.append(instance_cap)
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ from oslo_utils import units
|
||||||
from oslo_utils import versionutils
|
from oslo_utils import versionutils
|
||||||
from oslo_vmware import exceptions as vexc
|
from oslo_vmware import exceptions as vexc
|
||||||
|
|
||||||
from nova.compute import hv_type
|
|
||||||
from nova.compute import vm_mode
|
from nova.compute import vm_mode
|
||||||
import nova.conf
|
import nova.conf
|
||||||
from nova import context
|
from nova import context
|
||||||
|
@ -98,8 +97,12 @@ class VCState(object):
|
||||||
str(about_info.version))
|
str(about_info.version))
|
||||||
data["hypervisor_hostname"] = self._host_name
|
data["hypervisor_hostname"] = self._host_name
|
||||||
data["supported_instances"] = [
|
data["supported_instances"] = [
|
||||||
(obj_fields.Architecture.I686, hv_type.VMWARE, vm_mode.HVM),
|
(obj_fields.Architecture.I686,
|
||||||
(obj_fields.Architecture.X86_64, hv_type.VMWARE, vm_mode.HVM)]
|
obj_fields.HVType.VMWARE,
|
||||||
|
vm_mode.HVM),
|
||||||
|
(obj_fields.Architecture.X86_64,
|
||||||
|
obj_fields.HVType.VMWARE,
|
||||||
|
vm_mode.HVM)]
|
||||||
|
|
||||||
self._stats = data
|
self._stats = data
|
||||||
if self._auto_service_disabled:
|
if self._auto_service_disabled:
|
||||||
|
|
|
@ -24,7 +24,6 @@ from oslo_log import log as logging
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from nova.compute import hv_type
|
|
||||||
from nova.compute import task_states
|
from nova.compute import task_states
|
||||||
from nova.compute import vm_mode
|
from nova.compute import vm_mode
|
||||||
from nova.compute import vm_states
|
from nova.compute import vm_states
|
||||||
|
@ -288,7 +287,7 @@ def to_supported_instances(host_capabilities):
|
||||||
guestarch = obj_fields.Architecture.canonicalize(guestarch)
|
guestarch = obj_fields.Architecture.canonicalize(guestarch)
|
||||||
ostype = vm_mode.canonicalize(ostype)
|
ostype = vm_mode.canonicalize(ostype)
|
||||||
|
|
||||||
result.append((guestarch, hv_type.XEN, ostype))
|
result.append((guestarch, obj_fields.HVType.XEN, ostype))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
LOG.warning(_LW("Failed to extract instance support from %s"),
|
LOG.warning(_LW("Failed to extract instance support from %s"),
|
||||||
capability)
|
capability)
|
||||||
|
|
Loading…
Reference in New Issue