Merge "objects: Move 'arch' to 'fields.Architecture'"
This commit is contained in:
commit
6195408224
|
@ -1,162 +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 CPU architectures
|
||||
|
||||
The constants provide the standard names for all known processor
|
||||
architectures. Many have multiple variants to deal with big-endian
|
||||
vs little-endian modes, as well as 32 vs 64 bit word sizes. These
|
||||
names are chosen to be identical to the architecture names expected
|
||||
by libvirt, so if ever adding new ones, ensure it matches libvirt's
|
||||
expectation.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from nova import exception
|
||||
|
||||
ALPHA = "alpha"
|
||||
ARMV6 = "armv6"
|
||||
ARMV7 = "armv7l"
|
||||
ARMV7B = "armv7b"
|
||||
|
||||
AARCH64 = "aarch64"
|
||||
CRIS = "cris"
|
||||
I686 = "i686"
|
||||
IA64 = "ia64"
|
||||
LM32 = "lm32"
|
||||
|
||||
M68K = "m68k"
|
||||
MICROBLAZE = "microblaze"
|
||||
MICROBLAZEEL = "microblazeel"
|
||||
MIPS = "mips"
|
||||
MIPSEL = "mipsel"
|
||||
|
||||
MIPS64 = "mips64"
|
||||
MIPS64EL = "mips64el"
|
||||
OPENRISC = "openrisc"
|
||||
PARISC = "parisc"
|
||||
PARISC64 = "parisc64"
|
||||
|
||||
PPC = "ppc"
|
||||
PPCLE = "ppcle"
|
||||
PPC64 = "ppc64"
|
||||
PPC64LE = "ppc64le"
|
||||
PPCEMB = "ppcemb"
|
||||
|
||||
S390 = "s390"
|
||||
S390X = "s390x"
|
||||
SH4 = "sh4"
|
||||
SH4EB = "sh4eb"
|
||||
SPARC = "sparc"
|
||||
|
||||
SPARC64 = "sparc64"
|
||||
UNICORE32 = "unicore32"
|
||||
X86_64 = "x86_64"
|
||||
XTENSA = "xtensa"
|
||||
XTENSAEB = "xtensaeb"
|
||||
|
||||
|
||||
ALL = [
|
||||
ALPHA,
|
||||
ARMV6,
|
||||
ARMV7,
|
||||
ARMV7B,
|
||||
|
||||
AARCH64,
|
||||
CRIS,
|
||||
I686,
|
||||
IA64,
|
||||
LM32,
|
||||
|
||||
M68K,
|
||||
MICROBLAZE,
|
||||
MICROBLAZEEL,
|
||||
MIPS,
|
||||
MIPSEL,
|
||||
|
||||
MIPS64,
|
||||
MIPS64EL,
|
||||
OPENRISC,
|
||||
PARISC,
|
||||
PARISC64,
|
||||
|
||||
PPC,
|
||||
PPCLE,
|
||||
PPC64,
|
||||
PPC64LE,
|
||||
PPCEMB,
|
||||
|
||||
S390,
|
||||
S390X,
|
||||
SH4,
|
||||
SH4EB,
|
||||
SPARC,
|
||||
|
||||
SPARC64,
|
||||
UNICORE32,
|
||||
X86_64,
|
||||
XTENSA,
|
||||
XTENSAEB,
|
||||
]
|
||||
|
||||
|
||||
def from_host():
|
||||
"""Get the architecture of the host OS
|
||||
|
||||
:returns: the canonicalized host architecture
|
||||
"""
|
||||
|
||||
return canonicalize(os.uname()[4])
|
||||
|
||||
|
||||
def is_valid(name):
|
||||
"""Check if a string is a valid architecture
|
||||
|
||||
:param name: architecture name to validate
|
||||
|
||||
:returns: True if @name is valid
|
||||
"""
|
||||
|
||||
return name in ALL
|
||||
|
||||
|
||||
def canonicalize(name):
|
||||
"""Canonicalize the architecture name
|
||||
|
||||
:param name: architecture name to canonicalize
|
||||
|
||||
:returns: a canonical architecture name
|
||||
"""
|
||||
|
||||
if name is None:
|
||||
return None
|
||||
|
||||
newname = name.lower()
|
||||
|
||||
if newname in ("i386", "i486", "i586"):
|
||||
newname = I686
|
||||
|
||||
# Xen mistake from Icehouse or earlier
|
||||
if newname in ("x86_32", "x86_32p"):
|
||||
newname = I686
|
||||
|
||||
if newname == "amd64":
|
||||
newname = X86_64
|
||||
|
||||
if not is_valid(newname):
|
||||
raise exception.InvalidArchitectureName(arch=name)
|
||||
|
||||
return newname
|
|
@ -12,13 +12,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
from oslo_versionedobjects import fields
|
||||
import six
|
||||
|
||||
# TODO(berrange) Temporary import for Arch class
|
||||
from nova.compute import arch
|
||||
# TODO(berrange) Temporary import for CPU* classes
|
||||
from nova.compute import cpumodel
|
||||
# TODO(berrange) Temporary import for HVType class
|
||||
|
@ -97,13 +96,118 @@ class BaseNovaEnum(Enum):
|
|||
|
||||
|
||||
class Architecture(BaseNovaEnum):
|
||||
# TODO(berrange): move all constants out of 'nova.compute.arch'
|
||||
# into fields on this class
|
||||
ALL = arch.ALL
|
||||
"""Represents CPU architectures.
|
||||
|
||||
Provides the standard names for all known processor architectures.
|
||||
Many have multiple variants to deal with big-endian vs little-endian
|
||||
modes, as well as 32 vs 64 bit word sizes. These names are chosen to
|
||||
be identical to the architecture names expected by libvirt, so if
|
||||
ever adding new ones then ensure it matches libvirt's expectation.
|
||||
"""
|
||||
|
||||
ALPHA = 'alpha'
|
||||
ARMV6 = 'armv6'
|
||||
ARMV7 = 'armv7l'
|
||||
ARMV7B = 'armv7b'
|
||||
|
||||
AARCH64 = 'aarch64'
|
||||
CRIS = 'cris'
|
||||
I686 = 'i686'
|
||||
IA64 = 'ia64'
|
||||
LM32 = 'lm32'
|
||||
|
||||
M68K = 'm68k'
|
||||
MICROBLAZE = 'microblaze'
|
||||
MICROBLAZEEL = 'microblazeel'
|
||||
MIPS = 'mips'
|
||||
MIPSEL = 'mipsel'
|
||||
|
||||
MIPS64 = 'mips64'
|
||||
MIPS64EL = 'mips64el'
|
||||
OPENRISC = 'openrisc'
|
||||
PARISC = 'parisc'
|
||||
PARISC64 = 'parisc64'
|
||||
|
||||
PPC = 'ppc'
|
||||
PPCLE = 'ppcle'
|
||||
PPC64 = 'ppc64'
|
||||
PPC64LE = 'ppc64le'
|
||||
PPCEMB = 'ppcemb'
|
||||
|
||||
S390 = 's390'
|
||||
S390X = 's390x'
|
||||
SH4 = 'sh4'
|
||||
SH4EB = 'sh4eb'
|
||||
SPARC = 'sparc'
|
||||
|
||||
SPARC64 = 'sparc64'
|
||||
UNICORE32 = 'unicore32'
|
||||
X86_64 = 'x86_64'
|
||||
XTENSA = 'xtensa'
|
||||
XTENSAEB = 'xtensaeb'
|
||||
|
||||
ALL = (
|
||||
ALPHA, ARMV6, ARMV7, ARMV7B,
|
||||
AARCH64, CRIS, I686, IA64, LM32,
|
||||
M68K, MICROBLAZE, MICROBLAZEEL, MIPS, MIPSEL,
|
||||
MIPS64, MIPS64EL, OPENRISC, PARISC, PARISC64,
|
||||
PPC, PPCLE, PPC64, PPC64LE, PPCEMB,
|
||||
S390, S390X, SH4, SH4EB, SPARC,
|
||||
SPARC64, UNICORE32, X86_64, XTENSA, XTENSAEB,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_host(cls):
|
||||
"""Get the architecture of the host OS
|
||||
|
||||
:returns: the canonicalized host architecture
|
||||
"""
|
||||
|
||||
return cls.canonicalize(os.uname()[4])
|
||||
|
||||
@classmethod
|
||||
def is_valid(cls, name):
|
||||
"""Check if a string is a valid architecture
|
||||
|
||||
:param name: architecture name to validate
|
||||
|
||||
:returns: True if @name is valid
|
||||
"""
|
||||
|
||||
return name in cls.ALL
|
||||
|
||||
@classmethod
|
||||
def canonicalize(cls, name):
|
||||
"""Canonicalize the architecture name
|
||||
|
||||
:param name: architecture name to canonicalize
|
||||
|
||||
:returns: a canonical architecture name
|
||||
"""
|
||||
|
||||
if name is None:
|
||||
return None
|
||||
|
||||
newname = name.lower()
|
||||
|
||||
if newname in ("i386", "i486", "i586"):
|
||||
newname = cls.I686
|
||||
|
||||
# Xen mistake from Icehouse or earlier
|
||||
if newname in ("x86_32", "x86_32p"):
|
||||
newname = cls.I686
|
||||
|
||||
if newname == "amd64":
|
||||
newname = cls.X86_64
|
||||
|
||||
if not cls.is_valid(newname):
|
||||
raise exception.InvalidArchitectureName(arch=name)
|
||||
|
||||
return newname
|
||||
|
||||
def coerce(self, obj, attr, value):
|
||||
try:
|
||||
value = arch.canonicalize(value)
|
||||
value = self.canonicalize(value)
|
||||
except exception.InvalidArchitectureName:
|
||||
msg = _("Architecture name '%s' is not valid") % value
|
||||
raise ValueError(msg)
|
||||
|
|
|
@ -19,9 +19,9 @@ from distutils import versionpredicate
|
|||
from oslo_log import log as logging
|
||||
from oslo_utils import versionutils
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.compute import hv_type
|
||||
from nova.compute import vm_mode
|
||||
from nova.objects import fields
|
||||
from nova.scheduler import filters
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ class ImagePropertiesFilter(filters.BaseHostFilter):
|
|||
img_h_type = image_props.get('img_hv_type')
|
||||
img_vm_mode = image_props.get('hw_vm_mode')
|
||||
checked_img_props = (
|
||||
arch.canonicalize(img_arch),
|
||||
fields.Architecture.canonicalize(img_arch),
|
||||
hv_type.canonicalize(img_h_type),
|
||||
vm_mode.canonicalize(img_vm_mode)
|
||||
)
|
||||
|
|
|
@ -1,65 +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.
|
||||
|
||||
import os
|
||||
|
||||
import mock
|
||||
|
||||
from nova.compute import arch
|
||||
from nova import exception
|
||||
from nova import test
|
||||
|
||||
|
||||
class ArchTest(test.NoDBTestCase):
|
||||
|
||||
@mock.patch.object(os, "uname")
|
||||
def test_host(self, mock_uname):
|
||||
os.uname.return_value = (
|
||||
'Linux',
|
||||
'localhost.localdomain',
|
||||
'3.14.8-200.fc20.x86_64',
|
||||
'#1 SMP Mon Jun 16 21:57:53 UTC 2014',
|
||||
'i686'
|
||||
)
|
||||
|
||||
self.assertEqual(arch.I686, arch.from_host())
|
||||
|
||||
def test_valid_string(self):
|
||||
self.assertTrue(arch.is_valid("x86_64"))
|
||||
|
||||
def test_valid_constant(self):
|
||||
self.assertTrue(arch.is_valid(arch.X86_64))
|
||||
|
||||
def test_valid_bogus(self):
|
||||
self.assertFalse(arch.is_valid("x86_64wibble"))
|
||||
|
||||
def test_canonicalize_i386(self):
|
||||
self.assertEqual(arch.I686, arch.canonicalize("i386"))
|
||||
|
||||
def test_canonicalize_amd64(self):
|
||||
self.assertEqual(arch.X86_64, arch.canonicalize("amd64"))
|
||||
|
||||
def test_canonicalize_case(self):
|
||||
self.assertEqual(arch.X86_64, arch.canonicalize("X86_64"))
|
||||
|
||||
def test_canonicalize_compat_xen1(self):
|
||||
self.assertEqual(arch.I686, arch.canonicalize("x86_32"))
|
||||
|
||||
def test_canonicalize_compat_xen2(self):
|
||||
self.assertEqual(arch.I686, arch.canonicalize("x86_32p"))
|
||||
|
||||
def test_canonicalize_bogus(self):
|
||||
self.assertRaises(exception.InvalidArchitectureName,
|
||||
arch.canonicalize,
|
||||
"x86_64wibble")
|
|
@ -45,7 +45,6 @@ from nova import availability_zones
|
|||
from nova import block_device
|
||||
from nova import compute
|
||||
from nova.compute import api as compute_api
|
||||
from nova.compute import arch
|
||||
from nova.compute import flavors
|
||||
from nova.compute import manager as compute_manager
|
||||
from nova.compute import power_state
|
||||
|
@ -284,7 +283,7 @@ class BaseTestCase(test.TestCase):
|
|||
inst.vcpus = 0
|
||||
inst.root_gb = 0
|
||||
inst.ephemeral_gb = 0
|
||||
inst.architecture = arch.X86_64
|
||||
inst.architecture = obj_fields.Architecture.X86_64
|
||||
inst.os_type = 'Linux'
|
||||
inst.system_metadata = (
|
||||
params and params.get('system_metadata', {}) or {})
|
||||
|
@ -8996,7 +8995,7 @@ class ComputeAPITestCase(BaseTestCase):
|
|||
def test_instance_architecture(self):
|
||||
# Test the instance architecture.
|
||||
i_ref = self._create_fake_instance_obj()
|
||||
self.assertEqual(i_ref['architecture'], arch.X86_64)
|
||||
self.assertEqual(i_ref['architecture'], obj_fields.Architecture.X86_64)
|
||||
|
||||
def test_instance_unknown_architecture(self):
|
||||
# Test if the architecture is unknown.
|
||||
|
@ -10122,7 +10121,7 @@ class ComputeAPITestCase(BaseTestCase):
|
|||
inst['vcpus'] = 0
|
||||
inst['root_gb'] = 0
|
||||
inst['ephemeral_gb'] = 0
|
||||
inst['architecture'] = arch.X86_64
|
||||
inst['architecture'] = obj_fields.Architecture.X86_64
|
||||
inst['os_type'] = 'Linux'
|
||||
instance = self._create_fake_instance_obj(inst)
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ from oslo_utils import timeutils
|
|||
from oslo_utils import uuidutils
|
||||
|
||||
from nova.compute import api as compute_api
|
||||
from nova.compute import arch
|
||||
from nova.compute import cells_api as compute_cells_api
|
||||
from nova.compute import flavors
|
||||
from nova.compute import instance_actions
|
||||
|
@ -143,7 +142,7 @@ class _ComputeAPIUnitTestMixIn(object):
|
|||
instance.vcpus = 0
|
||||
instance.root_gb = 0
|
||||
instance.ephemeral_gb = 0
|
||||
instance.architecture = arch.X86_64
|
||||
instance.architecture = fields_obj.Architecture.X86_64
|
||||
instance.os_type = 'Linux'
|
||||
instance.locked = False
|
||||
instance.created_at = now
|
||||
|
@ -3014,8 +3013,10 @@ class _ComputeAPIUnitTestMixIn(object):
|
|||
get_flavor.return_value = test_flavor.fake_flavor
|
||||
flavor = instance.get_flavor()
|
||||
image_href = 'foo'
|
||||
image = {"min_ram": 10, "min_disk": 1,
|
||||
"properties": {'architecture': arch.X86_64}}
|
||||
image = {
|
||||
"min_ram": 10, "min_disk": 1,
|
||||
"properties": {
|
||||
'architecture': fields_obj.Architecture.X86_64}}
|
||||
admin_pass = ''
|
||||
files_to_inject = []
|
||||
bdms = objects.BlockDeviceMappingList()
|
||||
|
@ -3059,13 +3060,15 @@ class _ComputeAPIUnitTestMixIn(object):
|
|||
orig_system_metadata = {}
|
||||
get_flavor.return_value = test_flavor.fake_flavor
|
||||
orig_image_href = 'orig_image'
|
||||
orig_image = {"min_ram": 10, "min_disk": 1,
|
||||
"properties": {'architecture': arch.X86_64,
|
||||
'vm_mode': 'hvm'}}
|
||||
orig_image = {
|
||||
"min_ram": 10, "min_disk": 1,
|
||||
"properties": {'architecture': fields_obj.Architecture.X86_64,
|
||||
'vm_mode': 'hvm'}}
|
||||
new_image_href = 'new_image'
|
||||
new_image = {"min_ram": 10, "min_disk": 1,
|
||||
"properties": {'architecture': arch.X86_64,
|
||||
'vm_mode': 'xen'}}
|
||||
new_image = {
|
||||
"min_ram": 10, "min_disk": 1,
|
||||
"properties": {'architecture': fields_obj.Architecture.X86_64,
|
||||
'vm_mode': 'xen'}}
|
||||
admin_pass = ''
|
||||
files_to_inject = []
|
||||
bdms = objects.BlockDeviceMappingList()
|
||||
|
|
|
@ -18,7 +18,6 @@ from oslo_config import cfg
|
|||
from oslo_utils import timeutils
|
||||
from oslo_utils import units
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.compute import claims
|
||||
from nova.compute import hv_type
|
||||
from nova.compute.monitors import base as monitor_base
|
||||
|
@ -31,6 +30,7 @@ from nova import context
|
|||
from nova import exception as exc
|
||||
from nova import objects
|
||||
from nova.objects import base as obj_base
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova.objects import pci_device
|
||||
from nova.pci import manager as pci_manager
|
||||
from nova import test
|
||||
|
@ -78,7 +78,10 @@ _COMPUTE_NODE_FIXTURES = [
|
|||
disk_available_least=0,
|
||||
host_ip='1.1.1.1',
|
||||
supported_hv_specs=[
|
||||
objects.HVSpec.from_list([arch.I686, hv_type.KVM, vm_mode.HVM])
|
||||
objects.HVSpec.from_list([
|
||||
obj_fields.Architecture.I686,
|
||||
hv_type.KVM,
|
||||
vm_mode.HVM])
|
||||
],
|
||||
metrics=None,
|
||||
pci_device_pools=None,
|
||||
|
|
|
@ -49,7 +49,6 @@ from sqlalchemy import sql
|
|||
from sqlalchemy import Table
|
||||
|
||||
from nova import block_device
|
||||
from nova.compute import arch
|
||||
from nova.compute import task_states
|
||||
from nova.compute import vm_states
|
||||
import nova.conf
|
||||
|
@ -6495,12 +6494,13 @@ class AgentBuildTestCase(test.TestCase, ModelsObjectComparatorMixin):
|
|||
self._assertEqualObjects(agent_build, all_agent_builds[0])
|
||||
|
||||
def test_agent_build_get_by_triple(self):
|
||||
agent_build = db.agent_build_create(self.ctxt, {'hypervisor': 'kvm',
|
||||
'os': 'FreeBSD', 'architecture': arch.X86_64})
|
||||
self.assertIsNone(db.agent_build_get_by_triple(self.ctxt, 'kvm',
|
||||
'FreeBSD', 'i386'))
|
||||
agent_build = db.agent_build_create(
|
||||
self.ctxt, {'hypervisor': 'kvm', 'os': 'FreeBSD',
|
||||
'architecture': fields.Architecture.X86_64})
|
||||
self.assertIsNone(db.agent_build_get_by_triple(
|
||||
self.ctxt, 'kvm', 'FreeBSD', 'i386'))
|
||||
self._assertEqualObjects(agent_build, db.agent_build_get_by_triple(
|
||||
self.ctxt, 'kvm', 'FreeBSD', arch.X86_64))
|
||||
self.ctxt, 'kvm', 'FreeBSD', fields.Architecture.X86_64))
|
||||
|
||||
def test_agent_build_destroy(self):
|
||||
agent_build = db.agent_build_create(self.ctxt, {})
|
||||
|
@ -6527,14 +6527,14 @@ class AgentBuildTestCase(test.TestCase, ModelsObjectComparatorMixin):
|
|||
|
||||
def test_agent_build_exists(self):
|
||||
values = {'hypervisor': 'kvm', 'os': 'FreeBSD',
|
||||
'architecture': arch.X86_64}
|
||||
'architecture': fields.Architecture.X86_64}
|
||||
db.agent_build_create(self.ctxt, values)
|
||||
self.assertRaises(exception.AgentBuildExists, db.agent_build_create,
|
||||
self.ctxt, values)
|
||||
|
||||
def test_agent_build_get_all_by_hypervisor(self):
|
||||
values = {'hypervisor': 'kvm', 'os': 'FreeBSD',
|
||||
'architecture': arch.X86_64}
|
||||
'architecture': fields.Architecture.X86_64}
|
||||
created = db.agent_build_create(self.ctxt, values)
|
||||
actual = db.agent_build_get_all(self.ctxt, hypervisor='kvm')
|
||||
self._assertEqualListsOfObjects([created], actual)
|
||||
|
|
|
@ -22,9 +22,9 @@ import datetime
|
|||
from oslo_log import log as logging
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from nova.compute import arch
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova.tests import fixtures as nova_fixtures
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
@ -52,9 +52,10 @@ class _FakeImageService(object):
|
|||
'container_format': 'raw',
|
||||
'disk_format': 'raw',
|
||||
'size': '25165824',
|
||||
'properties': {'kernel_id': CONF.null_kernel,
|
||||
'ramdisk_id': CONF.null_kernel,
|
||||
'architecture': arch.X86_64}}
|
||||
'properties': {
|
||||
'kernel_id': CONF.null_kernel,
|
||||
'ramdisk_id': CONF.null_kernel,
|
||||
'architecture': obj_fields.Architecture.X86_64}}
|
||||
|
||||
image2 = {'id': 'a2459075-d96c-40d5-893e-577ff92e721c',
|
||||
'name': 'fakeimage123456',
|
||||
|
@ -124,10 +125,11 @@ class _FakeImageService(object):
|
|||
'container_format': 'ova',
|
||||
'disk_format': 'vhd',
|
||||
'size': '49163826',
|
||||
'properties': {'kernel_id': CONF.null_kernel,
|
||||
'ramdisk_id': CONF.null_kernel,
|
||||
'architecture': arch.X86_64,
|
||||
'auto_disk_config': 'False'}}
|
||||
'properties': {
|
||||
'kernel_id': CONF.null_kernel,
|
||||
'ramdisk_id': CONF.null_kernel,
|
||||
'architecture': obj_fields.Architecture.X86_64,
|
||||
'auto_disk_config': 'False'}}
|
||||
|
||||
image7 = {'id': AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID,
|
||||
'name': 'fakeimage7',
|
||||
|
@ -140,10 +142,11 @@ class _FakeImageService(object):
|
|||
'container_format': 'ova',
|
||||
'disk_format': 'vhd',
|
||||
'size': '74185822',
|
||||
'properties': {'kernel_id': CONF.null_kernel,
|
||||
'ramdisk_id': CONF.null_kernel,
|
||||
'architecture': arch.X86_64,
|
||||
'auto_disk_config': 'True'}}
|
||||
'properties': {
|
||||
'kernel_id': CONF.null_kernel,
|
||||
'ramdisk_id': CONF.null_kernel,
|
||||
'architecture': obj_fields.Architecture.X86_64,
|
||||
'auto_disk_config': 'True'}}
|
||||
|
||||
self.create(None, image1)
|
||||
self.create(None, image2)
|
||||
|
|
|
@ -13,11 +13,14 @@
|
|||
# under the License.
|
||||
|
||||
import datetime
|
||||
import os
|
||||
|
||||
import iso8601
|
||||
import mock
|
||||
from oslo_versionedobjects import exception as ovo_exc
|
||||
import six
|
||||
|
||||
from nova import exception
|
||||
from nova.network import model as network_model
|
||||
from nova.objects import fields
|
||||
from nova import signature_utils
|
||||
|
@ -177,6 +180,56 @@ class TestEnum(TestField):
|
|||
fields.EnumField, [])
|
||||
|
||||
|
||||
class TestArchitecture(TestField):
|
||||
@mock.patch.object(os, 'uname')
|
||||
def test_host(self, mock_uname):
|
||||
mock_uname.return_value = (
|
||||
'Linux',
|
||||
'localhost.localdomain',
|
||||
'3.14.8-200.fc20.x86_64',
|
||||
'#1 SMP Mon Jun 16 21:57:53 UTC 2014',
|
||||
'i686'
|
||||
)
|
||||
|
||||
self.assertEqual(fields.Architecture.I686,
|
||||
fields.Architecture.from_host())
|
||||
|
||||
def test_valid_string(self):
|
||||
self.assertTrue(fields.Architecture.is_valid('x86_64'))
|
||||
|
||||
def test_valid_constant(self):
|
||||
self.assertTrue(fields.Architecture.is_valid(
|
||||
fields.Architecture.X86_64))
|
||||
|
||||
def test_valid_bogus(self):
|
||||
self.assertFalse(fields.Architecture.is_valid('x86_64wibble'))
|
||||
|
||||
def test_canonicalize_i386(self):
|
||||
self.assertEqual(fields.Architecture.I686,
|
||||
fields.Architecture.canonicalize('i386'))
|
||||
|
||||
def test_canonicalize_amd64(self):
|
||||
self.assertEqual(fields.Architecture.X86_64,
|
||||
fields.Architecture.canonicalize('amd64'))
|
||||
|
||||
def test_canonicalize_case(self):
|
||||
self.assertEqual(fields.Architecture.X86_64,
|
||||
fields.Architecture.canonicalize('X86_64'))
|
||||
|
||||
def test_canonicalize_compat_xen1(self):
|
||||
self.assertEqual(fields.Architecture.I686,
|
||||
fields.Architecture.canonicalize('x86_32'))
|
||||
|
||||
def test_canonicalize_compat_xen2(self):
|
||||
self.assertEqual(fields.Architecture.I686,
|
||||
fields.Architecture.canonicalize('x86_32p'))
|
||||
|
||||
def test_canonicalize_bogus(self):
|
||||
self.assertRaises(exception.InvalidArchitectureName,
|
||||
fields.Architecture.canonicalize,
|
||||
'x86_64wibble')
|
||||
|
||||
|
||||
class TestImageSignatureTypes(TestField):
|
||||
# Ensure that the object definition is updated
|
||||
# in step with the signature_utils module
|
||||
|
|
|
@ -13,33 +13,33 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.compute import hv_type
|
||||
from nova.compute import vm_mode
|
||||
from nova import objects
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova.tests.unit.objects import test_objects
|
||||
|
||||
|
||||
spec_dict = {
|
||||
'arch': arch.I686,
|
||||
'arch': obj_fields.Architecture.I686,
|
||||
'hv_type': hv_type.KVM,
|
||||
'vm_mode': vm_mode.HVM
|
||||
}
|
||||
|
||||
spec_list = [
|
||||
arch.I686,
|
||||
obj_fields.Architecture.I686,
|
||||
hv_type.KVM,
|
||||
vm_mode.HVM
|
||||
]
|
||||
|
||||
spec_dict_vz = {
|
||||
'arch': arch.I686,
|
||||
'arch': obj_fields.Architecture.I686,
|
||||
'hv_type': hv_type.VIRTUOZZO,
|
||||
'vm_mode': vm_mode.HVM
|
||||
}
|
||||
|
||||
spec_dict_parallels = {
|
||||
'arch': arch.I686,
|
||||
'arch': obj_fields.Architecture.I686,
|
||||
'hv_type': hv_type.PARALLELS,
|
||||
'vm_mode': vm_mode.HVM
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class _TestHVSpecObject(object):
|
|||
|
||||
def test_hv_spec_to_list(self):
|
||||
spec_obj = objects.HVSpec()
|
||||
spec_obj.arch = arch.I686
|
||||
spec_obj.arch = obj_fields.Architecture.I686
|
||||
spec_obj.hv_type = hv_type.KVM
|
||||
spec_obj.vm_mode = vm_mode.HVM
|
||||
spec = spec_obj.to_list()
|
||||
|
|
|
@ -1129,10 +1129,10 @@ object_data = {
|
|||
'FloatingIPList': '1.11-7f2ba670714e1b7bab462ab3290f7159',
|
||||
'HostMapping': '1.0-1a3390a696792a552ab7bd31a77ba9ac',
|
||||
'HyperVLiveMigrateData': '1.1-9987a3cec31a81abac6fba7cc722e43f',
|
||||
'HVSpec': '1.2-db672e73304da86139086d003f3977e7',
|
||||
'HVSpec': '1.2-e1ef66eb58ac1be510300c5d9f8ad931',
|
||||
'IDEDeviceBus': '1.0-29d4c9f27ac44197f01b6ac1b7e16502',
|
||||
'ImageMeta': '1.8-642d1b2eb3e880a367f37d72dd76162d',
|
||||
'ImageMetaProps': '1.15-d45133ec8d2d4a6456338fb0ffd0e5c2',
|
||||
'ImageMetaProps': '1.15-28e104f642cbf04c7899d349e7e4d05d',
|
||||
'Instance': '2.3-4f98ab23f4b0a25fabb1040c8f5edecc',
|
||||
'InstanceAction': '1.1-f9f293e526b66fca0d05c3b3a2d13914',
|
||||
'InstanceActionEvent': '1.1-e56a64fa4710e43ef7af2ad9d6028b33',
|
||||
|
@ -1202,7 +1202,7 @@ object_data = {
|
|||
'UsageList': '1.0-de53f0fd078c27cc1d43400f4e8bcef8',
|
||||
'USBDeviceBus': '1.0-e4c7dd6032e46cd74b027df5eb2d4750',
|
||||
'VirtCPUFeature': '1.0-3310718d8c72309259a6e39bdefe83ee',
|
||||
'VirtCPUModel': '1.0-6a5cc9f322729fc70ddc6733bacd57d3',
|
||||
'VirtCPUModel': '1.0-288f2139801b5ed5ed1be25c93c7b845',
|
||||
'VirtCPUTopology': '1.0-fc694de72e20298f7c6bab1083fd4563',
|
||||
'VirtualInterface': '1.3-efd3ca8ebcc5ce65fff5a25f31754c54',
|
||||
'VirtualInterfaceList': '1.0-9750e2074437b3077e46359102779fc6',
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.compute import cpumodel
|
||||
from nova import objects
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova.tests.unit.objects import test_objects
|
||||
|
||||
fake_cpu_model_feature = {
|
||||
|
@ -24,7 +24,7 @@ fake_cpu_model_feature_obj = objects.VirtCPUFeature(
|
|||
**fake_cpu_model_feature)
|
||||
|
||||
fake_vcpumodel_dict = {
|
||||
'arch': arch.I686,
|
||||
'arch': obj_fields.Architecture.I686,
|
||||
'vendor': 'fake-vendor',
|
||||
'match': cpumodel.MATCH_EXACT,
|
||||
'topology': objects.VirtCPUTopology(sockets=1, cores=1, threads=1),
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
|
||||
from oslo_utils import versionutils
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.compute import hv_type
|
||||
from nova.compute import vm_mode
|
||||
from nova import objects
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova.scheduler.filters import image_props_filter
|
||||
from nova import test
|
||||
from nova.tests.unit.scheduler import fakes
|
||||
|
@ -30,122 +30,131 @@ class TestImagePropsFilter(test.NoDBTestCase):
|
|||
def test_image_properties_filter_passes_same_inst_props_and_version(self):
|
||||
img_props = objects.ImageMeta(
|
||||
properties=objects.ImageMetaProps(
|
||||
hw_architecture=arch.X86_64,
|
||||
hw_architecture=obj_fields.Architecture.X86_64,
|
||||
img_hv_type=hv_type.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':
|
||||
[(arch.X86_64, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
capabilities = {
|
||||
'supported_instances': [(
|
||||
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
||||
|
||||
def test_image_properties_filter_fails_different_inst_props(self):
|
||||
img_props = objects.ImageMeta(
|
||||
properties=objects.ImageMetaProps(
|
||||
hw_architecture=arch.ARMV7,
|
||||
hw_architecture=obj_fields.Architecture.ARMV7,
|
||||
img_hv_type=hv_type.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':
|
||||
[(arch.X86_64, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
capabilities = {
|
||||
'supported_instances': [(
|
||||
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
|
||||
|
||||
def test_image_properties_filter_fails_different_hyper_version(self):
|
||||
img_props = objects.ImageMeta(
|
||||
properties=objects.ImageMetaProps(
|
||||
hw_architecture=arch.X86_64,
|
||||
hw_architecture=obj_fields.Architecture.X86_64,
|
||||
img_hv_type=hv_type.KVM,
|
||||
hw_vm_mode=vm_mode.HVM,
|
||||
img_hv_requested_version='>=6.2'))
|
||||
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
||||
spec_obj = objects.RequestSpec(image=img_props)
|
||||
capabilities = {'enabled': True,
|
||||
'supported_instances':
|
||||
[(arch.X86_64, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
capabilities = {
|
||||
'enabled': True,
|
||||
'supported_instances': [(
|
||||
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
|
||||
|
||||
def test_image_properties_filter_passes_partial_inst_props(self):
|
||||
img_props = objects.ImageMeta(
|
||||
properties=objects.ImageMetaProps(
|
||||
hw_architecture=arch.X86_64,
|
||||
hw_architecture=obj_fields.Architecture.X86_64,
|
||||
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':
|
||||
[(arch.X86_64, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
capabilities = {
|
||||
'supported_instances': [(
|
||||
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
||||
|
||||
def test_image_properties_filter_fails_partial_inst_props(self):
|
||||
img_props = objects.ImageMeta(
|
||||
properties=objects.ImageMetaProps(
|
||||
hw_architecture=arch.X86_64,
|
||||
hw_architecture=obj_fields.Architecture.X86_64,
|
||||
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':
|
||||
[(arch.X86_64, hv_type.XEN, vm_mode.XEN)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
capabilities = {
|
||||
'supported_instances': [(
|
||||
obj_fields.Architecture.X86_64, hv_type.XEN, vm_mode.XEN)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
|
||||
|
||||
def test_image_properties_filter_passes_without_inst_props(self):
|
||||
spec_obj = objects.RequestSpec(image=None)
|
||||
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
||||
capabilities = {'supported_instances':
|
||||
[(arch.X86_64, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
capabilities = {
|
||||
'supported_instances': [(
|
||||
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
||||
|
||||
def test_image_properties_filter_fails_without_host_props(self):
|
||||
img_props = objects.ImageMeta(
|
||||
properties=objects.ImageMetaProps(
|
||||
hw_architecture=arch.X86_64,
|
||||
hw_architecture=obj_fields.Architecture.X86_64,
|
||||
img_hv_type=hv_type.KVM,
|
||||
hw_vm_mode=vm_mode.HVM))
|
||||
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
||||
spec_obj = objects.RequestSpec(image=img_props)
|
||||
capabilities = {'enabled': True,
|
||||
'hypervisor_version': hypervisor_version}
|
||||
capabilities = {
|
||||
'enabled': True,
|
||||
'hypervisor_version': hypervisor_version}
|
||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
|
||||
|
||||
def test_image_properties_filter_passes_without_hyper_version(self):
|
||||
img_props = objects.ImageMeta(
|
||||
properties=objects.ImageMetaProps(
|
||||
hw_architecture=arch.X86_64,
|
||||
hw_architecture=obj_fields.Architecture.X86_64,
|
||||
img_hv_type=hv_type.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':
|
||||
[(arch.X86_64, hv_type.KVM, vm_mode.HVM)]}
|
||||
capabilities = {
|
||||
'enabled': True,
|
||||
'supported_instances': [(
|
||||
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)]}
|
||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
||||
|
||||
def test_image_properties_filter_fails_with_unsupported_hyper_ver(self):
|
||||
img_props = objects.ImageMeta(
|
||||
properties=objects.ImageMetaProps(
|
||||
hw_architecture=arch.X86_64,
|
||||
hw_architecture=obj_fields.Architecture.X86_64,
|
||||
img_hv_type=hv_type.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':
|
||||
[(arch.X86_64, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': 5000}
|
||||
capabilities = {
|
||||
'enabled': True,
|
||||
'supported_instances': [(
|
||||
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': 5000}
|
||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
|
||||
|
||||
|
@ -156,9 +165,10 @@ class TestImagePropsFilter(test.NoDBTestCase):
|
|||
hw_vm_mode='pv'))
|
||||
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
||||
spec_obj = objects.RequestSpec(image=img_props)
|
||||
capabilities = {'supported_instances':
|
||||
[(arch.X86_64, hv_type.XEN, vm_mode.XEN)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
capabilities = {
|
||||
'supported_instances': [(
|
||||
obj_fields.Architecture.X86_64, hv_type.XEN, vm_mode.XEN)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
||||
|
||||
|
@ -169,9 +179,10 @@ class TestImagePropsFilter(test.NoDBTestCase):
|
|||
hw_vm_mode='hv'))
|
||||
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
||||
spec_obj = objects.RequestSpec(image=img_props)
|
||||
capabilities = {'supported_instances':
|
||||
[(arch.X86_64, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
capabilities = {
|
||||
'supported_instances': [(
|
||||
obj_fields.Architecture.X86_64, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
||||
|
||||
|
@ -182,9 +193,10 @@ class TestImagePropsFilter(test.NoDBTestCase):
|
|||
hw_architecture='x86_32'))
|
||||
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
||||
spec_obj = objects.RequestSpec(image=img_props)
|
||||
capabilities = {'supported_instances':
|
||||
[(arch.I686, hv_type.KVM, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
capabilities = {
|
||||
'supported_instances': [(
|
||||
obj_fields.Architecture.I686, hv_type.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,9 +207,10 @@ class TestImagePropsFilter(test.NoDBTestCase):
|
|||
img_hv_type='xapi'))
|
||||
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
||||
spec_obj = objects.RequestSpec(image=img_props)
|
||||
capabilities = {'supported_instances':
|
||||
[(arch.I686, hv_type.XEN, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
capabilities = {
|
||||
'supported_instances': [(
|
||||
obj_fields.Architecture.I686, hv_type.XEN, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
||||
|
||||
|
@ -209,8 +222,9 @@ class TestImagePropsFilter(test.NoDBTestCase):
|
|||
hw_vm_mode='baremetal'))
|
||||
hypervisor_version = versionutils.convert_version_to_int('6.0.0')
|
||||
spec_obj = objects.RequestSpec(image=img_props)
|
||||
capabilities = {'supported_instances':
|
||||
[(arch.I686, hv_type.BAREMETAL, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
capabilities = {
|
||||
'supported_instances': [(
|
||||
obj_fields.Architecture.I686, hv_type.BAREMETAL, vm_mode.HVM)],
|
||||
'hypervisor_version': hypervisor_version}
|
||||
host = fakes.FakeHostState('host1', 'node1', capabilities)
|
||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
Unit Tests for instance types extra specs code
|
||||
"""
|
||||
|
||||
from nova.compute import arch
|
||||
from nova import context
|
||||
from nova import objects
|
||||
from nova.objects import fields
|
||||
from nova import test
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ class InstanceTypeExtraSpecsTestCase(test.TestCase):
|
|||
root_gb=1690,
|
||||
ephemeral_gb=2000,
|
||||
flavorid=105)
|
||||
self.specs = dict(cpu_arch=arch.X86_64,
|
||||
self.specs = dict(cpu_arch=fields.Architecture.X86_64,
|
||||
cpu_model="Nehalem",
|
||||
xpu_arch="fermi",
|
||||
xpus="2",
|
||||
|
|
|
@ -20,7 +20,7 @@ import fixtures
|
|||
from lxml import etree
|
||||
import six
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova.virt.libvirt import config as vconfig
|
||||
|
||||
# Allow passing None to the various connect methods
|
||||
|
@ -288,7 +288,7 @@ class HostPciSRIOVDevicesInfo(object):
|
|||
|
||||
|
||||
class HostInfo(object):
|
||||
def __init__(self, arch=arch.X86_64, kB_mem=4096,
|
||||
def __init__(self, arch=obj_fields.Architecture.X86_64, kB_mem=4096,
|
||||
cpus=2, cpu_mhz=800, cpu_nodes=1,
|
||||
cpu_sockets=1, cpu_cores=2,
|
||||
cpu_threads=1, cpu_model="Penryn",
|
||||
|
@ -1342,8 +1342,8 @@ class Connection(object):
|
|||
|
||||
arch_node = tree.find('./arch')
|
||||
if arch_node is not None:
|
||||
if arch_node.text not in [arch.X86_64,
|
||||
arch.I686]:
|
||||
if arch_node.text not in [obj_fields.Architecture.X86_64,
|
||||
obj_fields.Architecture.I686]:
|
||||
return VIR_CPU_COMPARE_INCOMPATIBLE
|
||||
|
||||
model_node = tree.find('./model')
|
||||
|
|
|
@ -19,10 +19,10 @@ import fixtures
|
|||
import mock
|
||||
|
||||
from nova import block_device
|
||||
from nova.compute import arch
|
||||
from nova import context
|
||||
from nova import exception
|
||||
from nova import objects
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova import test
|
||||
from nova.tests.unit import fake_block_device
|
||||
import nova.tests.unit.image.fake
|
||||
|
@ -722,23 +722,23 @@ class LibvirtBlockInfoTest(test.NoDBTestCase):
|
|||
def test_get_disk_bus(self):
|
||||
instance = objects.Instance(**self.test_instance)
|
||||
expected = (
|
||||
(arch.X86_64, 'disk', 'virtio'),
|
||||
(arch.X86_64, 'cdrom', 'ide'),
|
||||
(arch.X86_64, 'floppy', 'fdc'),
|
||||
(arch.PPC, 'disk', 'virtio'),
|
||||
(arch.PPC, 'cdrom', 'scsi'),
|
||||
(arch.PPC64, 'disk', 'virtio'),
|
||||
(arch.PPC64, 'cdrom', 'scsi'),
|
||||
(arch.PPCLE, 'disk', 'virtio'),
|
||||
(arch.PPCLE, 'cdrom', 'scsi'),
|
||||
(arch.PPC64LE, 'disk', 'virtio'),
|
||||
(arch.PPC64LE, 'cdrom', 'scsi'),
|
||||
(arch.S390, 'disk', 'virtio'),
|
||||
(arch.S390, 'cdrom', 'scsi'),
|
||||
(arch.S390X, 'disk', 'virtio'),
|
||||
(arch.S390X, 'cdrom', 'scsi'),
|
||||
(arch.AARCH64, 'disk', 'virtio'),
|
||||
(arch.AARCH64, 'cdrom', 'scsi')
|
||||
(obj_fields.Architecture.X86_64, 'disk', 'virtio'),
|
||||
(obj_fields.Architecture.X86_64, 'cdrom', 'ide'),
|
||||
(obj_fields.Architecture.X86_64, 'floppy', 'fdc'),
|
||||
(obj_fields.Architecture.PPC, 'disk', 'virtio'),
|
||||
(obj_fields.Architecture.PPC, 'cdrom', 'scsi'),
|
||||
(obj_fields.Architecture.PPC64, 'disk', 'virtio'),
|
||||
(obj_fields.Architecture.PPC64, 'cdrom', 'scsi'),
|
||||
(obj_fields.Architecture.PPCLE, 'disk', 'virtio'),
|
||||
(obj_fields.Architecture.PPCLE, 'cdrom', 'scsi'),
|
||||
(obj_fields.Architecture.PPC64LE, 'disk', 'virtio'),
|
||||
(obj_fields.Architecture.PPC64LE, 'cdrom', 'scsi'),
|
||||
(obj_fields.Architecture.S390, 'disk', 'virtio'),
|
||||
(obj_fields.Architecture.S390, 'cdrom', 'scsi'),
|
||||
(obj_fields.Architecture.S390X, 'disk', 'virtio'),
|
||||
(obj_fields.Architecture.S390X, 'cdrom', 'scsi'),
|
||||
(obj_fields.Architecture.AARCH64, 'disk', 'virtio'),
|
||||
(obj_fields.Architecture.AARCH64, 'cdrom', 'scsi')
|
||||
)
|
||||
image_meta = objects.ImageMeta.from_dict(self.test_image_meta)
|
||||
for guestarch, dev, res in expected:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
from lxml import etree
|
||||
from oslo_utils import units
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova import test
|
||||
from nova.tests.unit import matchers
|
||||
from nova.virt.libvirt import config
|
||||
|
@ -330,7 +330,7 @@ class LibvirtConfigCPUTest(LibvirtConfigBaseTest):
|
|||
obj = config.LibvirtConfigCPU()
|
||||
obj.model = "Penryn"
|
||||
obj.vendor = "Intel"
|
||||
obj.arch = arch.X86_64
|
||||
obj.arch = obj_fields.Architecture.X86_64
|
||||
|
||||
obj.add_feature(config.LibvirtConfigCPUFeature("mtrr"))
|
||||
obj.add_feature(config.LibvirtConfigCPUFeature("apic"))
|
||||
|
@ -350,7 +350,7 @@ class LibvirtConfigCPUTest(LibvirtConfigBaseTest):
|
|||
obj = config.LibvirtConfigCPU()
|
||||
obj.model = "Penryn"
|
||||
obj.vendor = "Intel"
|
||||
obj.arch = arch.X86_64
|
||||
obj.arch = obj_fields.Architecture.X86_64
|
||||
|
||||
obj.add_feature(config.LibvirtConfigCPUFeature("mtrr"))
|
||||
obj.add_feature(config.LibvirtConfigCPUFeature("apic"))
|
||||
|
@ -401,7 +401,7 @@ class LibvirtConfigGuestCPUTest(LibvirtConfigBaseTest):
|
|||
obj = config.LibvirtConfigGuestCPU()
|
||||
obj.model = "Penryn"
|
||||
obj.vendor = "Intel"
|
||||
obj.arch = arch.X86_64
|
||||
obj.arch = obj_fields.Architecture.X86_64
|
||||
obj.mode = "custom"
|
||||
|
||||
obj.add_feature(config.LibvirtConfigGuestCPUFeature("mtrr"))
|
||||
|
|
|
@ -56,7 +56,6 @@ from six.moves import builtins
|
|||
from six.moves import range
|
||||
|
||||
from nova.api.metadata import base as instance_metadata
|
||||
from nova.compute import arch
|
||||
from nova.compute import cpumodel
|
||||
from nova.compute import manager
|
||||
from nova.compute import power_state
|
||||
|
@ -912,12 +911,13 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_LIBVIRT_OTHER_ARCH.get(
|
||||
arch.PPC64)) - 1)
|
||||
fields.Architecture.PPC64)) - 1)
|
||||
@mock.patch.object(fakelibvirt.Connection, 'getVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_QEMU_OTHER_ARCH.get(
|
||||
arch.PPC64)))
|
||||
@mock.patch.object(arch, "from_host", return_value=arch.PPC64)
|
||||
fields.Architecture.PPC64)))
|
||||
@mock.patch.object(fields.Architecture, "from_host",
|
||||
return_value=fields.Architecture.PPC64)
|
||||
def test_min_version_ppc_old_libvirt(self, mock_libv, mock_qemu,
|
||||
mock_arch):
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
@ -928,12 +928,13 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_LIBVIRT_OTHER_ARCH.get(
|
||||
arch.PPC64)))
|
||||
fields.Architecture.PPC64)))
|
||||
@mock.patch.object(fakelibvirt.Connection, 'getVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_QEMU_OTHER_ARCH.get(
|
||||
arch.PPC64)) - 1)
|
||||
@mock.patch.object(arch, "from_host", return_value=arch.PPC64)
|
||||
fields.Architecture.PPC64)) - 1)
|
||||
@mock.patch.object(fields.Architecture, "from_host",
|
||||
return_value=fields.Architecture.PPC64)
|
||||
def test_min_version_ppc_old_qemu(self, mock_libv, mock_qemu,
|
||||
mock_arch):
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
@ -944,12 +945,13 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_LIBVIRT_OTHER_ARCH.get(
|
||||
arch.PPC64)))
|
||||
fields.Architecture.PPC64)))
|
||||
@mock.patch.object(fakelibvirt.Connection, 'getVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_QEMU_OTHER_ARCH.get(
|
||||
arch.PPC64)))
|
||||
@mock.patch.object(arch, "from_host", return_value=arch.PPC64)
|
||||
fields.Architecture.PPC64)))
|
||||
@mock.patch.object(fields.Architecture, "from_host",
|
||||
return_value=fields.Architecture.PPC64)
|
||||
def test_min_version_ppc_ok(self, mock_libv, mock_qemu, mock_arch):
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
drvr.init_host("dummyhost")
|
||||
|
@ -957,12 +959,13 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_LIBVIRT_OTHER_ARCH.get(
|
||||
arch.S390X)) - 1)
|
||||
fields.Architecture.S390X)) - 1)
|
||||
@mock.patch.object(fakelibvirt.Connection, 'getVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_QEMU_OTHER_ARCH.get(
|
||||
arch.S390X)))
|
||||
@mock.patch.object(arch, "from_host", return_value=arch.S390X)
|
||||
fields.Architecture.S390X)))
|
||||
@mock.patch.object(fields.Architecture, "from_host",
|
||||
return_value=fields.Architecture.S390X)
|
||||
def test_min_version_s390_old_libvirt(self, mock_libv, mock_qemu,
|
||||
mock_arch):
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
@ -973,12 +976,13 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_LIBVIRT_OTHER_ARCH.get(
|
||||
arch.S390X)))
|
||||
fields.Architecture.S390X)))
|
||||
@mock.patch.object(fakelibvirt.Connection, 'getVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_QEMU_OTHER_ARCH.get(
|
||||
arch.S390X)) - 1)
|
||||
@mock.patch.object(arch, "from_host", return_value=arch.S390X)
|
||||
fields.Architecture.S390X)) - 1)
|
||||
@mock.patch.object(fields.Architecture, "from_host",
|
||||
return_value=fields.Architecture.S390X)
|
||||
def test_min_version_s390_old_qemu(self, mock_libv, mock_qemu,
|
||||
mock_arch):
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
@ -989,12 +993,13 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_LIBVIRT_OTHER_ARCH.get(
|
||||
arch.S390X)))
|
||||
fields.Architecture.S390X)))
|
||||
@mock.patch.object(fakelibvirt.Connection, 'getVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_QEMU_OTHER_ARCH.get(
|
||||
arch.S390X)))
|
||||
@mock.patch.object(arch, "from_host", return_value=arch.S390X)
|
||||
fields.Architecture.S390X)))
|
||||
@mock.patch.object(fields.Architecture, "from_host",
|
||||
return_value=fields.Architecture.S390X)
|
||||
def test_min_version_s390_ok(self, mock_libv, mock_qemu, mock_arch):
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
drvr.init_host("dummyhost")
|
||||
|
@ -1764,7 +1769,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
|
||||
def fake_get_host_capabilities(**args):
|
||||
cpu = vconfig.LibvirtConfigGuestCPU()
|
||||
cpu.arch = arch.ARMV7
|
||||
cpu.arch = fields.Architecture.ARMV7
|
||||
|
||||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
|
@ -1986,7 +1991,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology()
|
||||
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
@ -2018,7 +2023,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology()
|
||||
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
@ -2131,7 +2136,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology()
|
||||
|
||||
conn = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
@ -2179,7 +2184,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology()
|
||||
|
||||
conn = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
@ -2268,7 +2273,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_QEMU_NUMA_HUGEPAGE_VERSION),
|
||||
host.HV_DRIVER_QEMU,
|
||||
arch.X86_64,
|
||||
fields.Architecture.X86_64,
|
||||
exception.NUMATopologyUnsupported,
|
||||
None)
|
||||
|
||||
|
@ -2281,7 +2286,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_QEMU_NUMA_HUGEPAGE_VERSION),
|
||||
host.HV_DRIVER_QEMU,
|
||||
arch.PPC64LE,
|
||||
fields.Architecture.PPC64LE,
|
||||
exception.NUMATopologyUnsupported,
|
||||
None)
|
||||
|
||||
|
@ -2294,7 +2299,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_QEMU_NUMA_HUGEPAGE_VERSION),
|
||||
host.HV_DRIVER_QEMU,
|
||||
arch.X86_64,
|
||||
fields.Architecture.X86_64,
|
||||
exception.NUMATopologyUnsupported,
|
||||
None)
|
||||
|
||||
|
@ -2321,7 +2326,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_QEMU_NUMA_HUGEPAGE_VERSION) - 1,
|
||||
host.HV_DRIVER_QEMU,
|
||||
arch.X86_64,
|
||||
fields.Architecture.X86_64,
|
||||
exception.NUMATopologyUnsupported,
|
||||
None)
|
||||
|
||||
|
@ -2334,7 +2339,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_QEMU_NUMA_HUGEPAGE_VERSION),
|
||||
host.HV_DRIVER_QEMU,
|
||||
arch.S390,
|
||||
fields.Architecture.S390,
|
||||
exception.NUMATopologyUnsupported,
|
||||
None)
|
||||
|
||||
|
@ -2345,7 +2350,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
libvirt_driver.MIN_LIBVIRT_NUMA_VERSION),
|
||||
versionutils.convert_version_to_int((4, 5, 0)),
|
||||
'XEN',
|
||||
arch.X86_64,
|
||||
fields.Architecture.X86_64,
|
||||
exception.NUMATopologyUnsupported,
|
||||
None)
|
||||
|
||||
|
@ -2358,7 +2363,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_QEMU_NUMA_HUGEPAGE_VERSION),
|
||||
host.HV_DRIVER_QEMU,
|
||||
arch.X86_64,
|
||||
fields.Architecture.X86_64,
|
||||
exception.MemoryPagesUnsupported,
|
||||
2048)
|
||||
|
||||
|
@ -2371,7 +2376,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_QEMU_NUMA_HUGEPAGE_VERSION) - 1,
|
||||
host.HV_DRIVER_QEMU,
|
||||
arch.X86_64,
|
||||
fields.Architecture.X86_64,
|
||||
exception.NUMATopologyUnsupported,
|
||||
2048)
|
||||
|
||||
|
@ -2389,7 +2394,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology(kb_mem=4194304)
|
||||
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
@ -2435,7 +2440,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = None
|
||||
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
@ -2484,7 +2489,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology()
|
||||
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
@ -2562,7 +2567,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology()
|
||||
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
@ -2638,7 +2643,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology(
|
||||
sockets_per_cell=4, cores_per_socket=3, threads_per_core=2)
|
||||
|
||||
|
@ -2716,7 +2721,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology()
|
||||
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
@ -2790,7 +2795,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology()
|
||||
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
@ -2933,7 +2938,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology()
|
||||
|
||||
mock_caps.return_value = caps
|
||||
|
@ -2952,10 +2957,13 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
return_value=True)
|
||||
@mock.patch.object(host.Host, "get_capabilities")
|
||||
def test_does_want_hugepages(self, mock_caps, mock_hp, mock_numa):
|
||||
for each_arch in [arch.I686, arch.X86_64, arch.PPC64LE, arch.PPC64,
|
||||
arch.AARCH64]:
|
||||
for arch in [fields.Architecture.I686,
|
||||
fields.Architecture.X86_64,
|
||||
fields.Architecture.AARCH64,
|
||||
fields.Architecture.PPC64LE,
|
||||
fields.Architecture.PPC64]:
|
||||
self._test_does_want_hugepages(
|
||||
mock_caps, mock_hp, mock_numa, each_arch)
|
||||
mock_caps, mock_hp, mock_numa, arch)
|
||||
|
||||
def _test_does_want_hugepages(self, mock_caps, mock_hp, mock_numa,
|
||||
architecture):
|
||||
|
@ -2999,12 +3007,12 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
instance_ref,
|
||||
image_meta)
|
||||
hpet_map = {
|
||||
arch.X86_64: True,
|
||||
arch.I686: True,
|
||||
arch.PPC: False,
|
||||
arch.PPC64: False,
|
||||
arch.ARMV7: False,
|
||||
arch.AARCH64: False,
|
||||
fields.Architecture.X86_64: True,
|
||||
fields.Architecture.I686: True,
|
||||
fields.Architecture.PPC: False,
|
||||
fields.Architecture.PPC64: False,
|
||||
fields.Architecture.ARMV7: False,
|
||||
fields.Architecture.AARCH64: False,
|
||||
}
|
||||
|
||||
for guestarch, expect_hpet in hpet_map.items():
|
||||
|
@ -3040,7 +3048,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
@mock.patch.object(host.Host, 'has_min_version')
|
||||
def test_get_guest_config_windows(self, mock_version, mock_get_arch):
|
||||
mock_version.return_value = False
|
||||
mock_get_arch.return_value = arch.I686
|
||||
mock_get_arch.return_value = fields.Architecture.I686
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
instance_ref = objects.Instance(**self.test_instance)
|
||||
instance_ref['os_type'] = 'windows'
|
||||
|
@ -3067,7 +3075,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
@mock.patch.object(host.Host, 'has_min_version')
|
||||
def test_get_guest_config_windows_timer(self, mock_version, mock_get_arch):
|
||||
mock_version.return_value = True
|
||||
mock_get_arch.return_value = arch.I686
|
||||
mock_get_arch.return_value = fields.Architecture.I686
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
instance_ref = objects.Instance(**self.test_instance)
|
||||
instance_ref['os_type'] = 'windows'
|
||||
|
@ -3252,7 +3260,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
|
||||
with mock.patch.object(drvr._host,
|
||||
'has_min_version', return_value=True):
|
||||
|
@ -3625,9 +3633,10 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
self.flags(enabled=True, group='serial_console')
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
|
||||
expected = {arch.X86_64: vconfig.LibvirtConfigGuestSerial,
|
||||
arch.S390: vconfig.LibvirtConfigGuestConsole,
|
||||
arch.S390X: vconfig.LibvirtConfigGuestConsole}
|
||||
expected = {
|
||||
fields.Architecture.X86_64: vconfig.LibvirtConfigGuestSerial,
|
||||
fields.Architecture.S390: vconfig.LibvirtConfigGuestConsole,
|
||||
fields.Architecture.S390X: vconfig.LibvirtConfigGuestConsole}
|
||||
|
||||
caps = drvr._host.get_capabilities()
|
||||
|
||||
|
@ -3645,7 +3654,9 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
@mock.patch('nova.virt.hardware.get_number_of_serial_ports',
|
||||
return_value=4)
|
||||
@mock.patch.object(libvirt_driver.libvirt_utils, 'get_arch',
|
||||
side_effect=[arch.X86_64, arch.S390, arch.S390X])
|
||||
side_effect=[fields.Architecture.X86_64,
|
||||
fields.Architecture.S390,
|
||||
fields.Architecture.S390X])
|
||||
def test_create_serial_console_devices_with_limit_exceeded_based_on_arch(
|
||||
self, mock_get_arch, mock_get_port_number):
|
||||
self.flags(enabled=True, group='serial_console')
|
||||
|
@ -4002,14 +4013,14 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
self.assertEqual(cfg.devices[4].type, "xen")
|
||||
|
||||
@mock.patch.object(libvirt_driver.libvirt_utils, 'get_arch',
|
||||
return_value=arch.S390X)
|
||||
return_value=fields.Architecture.S390X)
|
||||
def test_get_guest_config_with_type_kvm_on_s390(self, mock_get_arch):
|
||||
self.flags(enabled=False, group='vnc')
|
||||
self.flags(virt_type='kvm',
|
||||
use_usb_tablet=False,
|
||||
group='libvirt')
|
||||
|
||||
self._stub_host_capabilities_cpu_arch(arch.S390X)
|
||||
self._stub_host_capabilities_cpu_arch(fields.Architecture.S390X)
|
||||
|
||||
instance_ref = objects.Instance(**self.test_instance)
|
||||
|
||||
|
@ -5185,7 +5196,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
def test_get_guest_config_armv7(self, mock_numa, mock_storage):
|
||||
def get_host_capabilities_stub(self):
|
||||
cpu = vconfig.LibvirtConfigGuestCPU()
|
||||
cpu.arch = arch.ARMV7
|
||||
cpu.arch = fields.Architecture.ARMV7
|
||||
|
||||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
|
@ -5217,7 +5228,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
def test_get_guest_config_aarch64(self, mock_numa, mock_storage):
|
||||
def get_host_capabilities_stub(self):
|
||||
cpu = vconfig.LibvirtConfigGuestCPU()
|
||||
cpu.arch = arch.AARCH64
|
||||
cpu.arch = fields.Architecture.AARCH64
|
||||
|
||||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
|
@ -5251,7 +5262,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps.host.cpu = vconfig.LibvirtConfigGuestCPU()
|
||||
|
||||
image_meta = objects.ImageMeta.from_dict(self.test_image_meta)
|
||||
host_cpu_archs = (arch.S390, arch.S390X)
|
||||
host_cpu_archs = (fields.Architecture.S390, fields.Architecture.S390X)
|
||||
for host_cpu_arch in host_cpu_archs:
|
||||
caps.host.cpu.arch = host_cpu_arch
|
||||
os_mach_type = drvr._get_machine_type(image_meta, caps)
|
||||
|
@ -5336,7 +5347,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
instance_ref,
|
||||
image_meta)
|
||||
image_meta = objects.ImageMeta.from_dict(self.test_image_meta)
|
||||
expected = (arch.PPC64, arch.PPC)
|
||||
expected = (fields.Architecture.PPC64, fields.Architecture.PPC)
|
||||
for guestarch in expected:
|
||||
with mock.patch.object(libvirt_driver.libvirt_utils,
|
||||
'get_arch',
|
||||
|
@ -5658,7 +5669,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology()
|
||||
|
||||
mock_get_caps.return_value = caps
|
||||
|
@ -5699,7 +5710,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology()
|
||||
|
||||
features = []
|
||||
|
@ -5727,7 +5738,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
|
||||
self._test_get_guest_with_perf(caps, [])
|
||||
|
||||
|
@ -5740,7 +5751,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology()
|
||||
|
||||
self._test_get_guest_with_perf(caps, [])
|
||||
|
@ -5836,10 +5847,10 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
# power doesn't have support to ide, and so libvirt translate
|
||||
# all ide calls to scsi
|
||||
|
||||
expected = {arch.PPC: ("cdrom", "scsi", "sda"),
|
||||
arch.PPC64: ("cdrom", "scsi", "sda"),
|
||||
arch.PPC64LE: ("cdrom", "scsi", "sda"),
|
||||
arch.AARCH64: ("cdrom", "scsi", "sda")}
|
||||
expected = {fields.Architecture.PPC: ("cdrom", "scsi", "sda"),
|
||||
fields.Architecture.PPC64: ("cdrom", "scsi", "sda"),
|
||||
fields.Architecture.PPC64LE: ("cdrom", "scsi", "sda"),
|
||||
fields.Architecture.AARCH64: ("cdrom", "scsi", "sda")}
|
||||
|
||||
expec_val = expected.get(blockinfo.libvirt_utils.get_arch({}),
|
||||
("cdrom", "ide", "hda"))
|
||||
|
@ -5854,10 +5865,10 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
# power doesn't have support to ide, and so libvirt translate
|
||||
# all ide calls to scsi
|
||||
|
||||
expected = {arch.PPC: ("cdrom", "scsi", "sda"),
|
||||
arch.PPC64: ("cdrom", "scsi", "sda"),
|
||||
arch.PPC64LE: ("cdrom", "scsi", "sda"),
|
||||
arch.AARCH64: ("cdrom", "scsi", "sda")}
|
||||
expected = {fields.Architecture.PPC: ("cdrom", "scsi", "sda"),
|
||||
fields.Architecture.PPC64: ("cdrom", "scsi", "sda"),
|
||||
fields.Architecture.PPC64LE: ("cdrom", "scsi", "sda"),
|
||||
fields.Architecture.AARCH64: ("cdrom", "scsi", "sda")}
|
||||
|
||||
swap = {'device_name': '/dev/vdc',
|
||||
'swap_size': 1}
|
||||
|
@ -6240,7 +6251,8 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
drvr.detach_volume(connection_info, instance, '/dev/vdc')
|
||||
|
||||
mock_get_domain.assert_called_with(instance)
|
||||
mock_dom.detachDeviceFlags.assert_called_with("""<disk type="file" device="disk">
|
||||
mock_dom.detachDeviceFlags.assert_called_with(
|
||||
"""<disk type="file" device="disk">
|
||||
<source file="/path/to/fake-volume"/>
|
||||
<target bus="virtio" dev="vdc"/>
|
||||
</disk>
|
||||
|
@ -6914,7 +6926,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
|
||||
compute_info = {'cpu_info': jsonutils.dumps({
|
||||
"vendor": "AMD",
|
||||
"arch": arch.I686,
|
||||
"arch": fields.Architecture.I686,
|
||||
"features": ["sse3"],
|
||||
"model": "Opteron_G3",
|
||||
"topology": {"cores": 2, "threads": 1, "sockets": 4}
|
||||
|
@ -12293,7 +12305,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
cpu = vconfig.LibvirtConfigCPU()
|
||||
cpu.model = "Opteron_G4"
|
||||
cpu.vendor = "AMD"
|
||||
cpu.arch = arch.X86_64
|
||||
cpu.arch = fields.Architecture.X86_64
|
||||
|
||||
cpu.cells = 1
|
||||
cpu.cores = 2
|
||||
|
@ -12309,13 +12321,13 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
|
||||
guest = vconfig.LibvirtConfigGuest()
|
||||
guest.ostype = vm_mode.HVM
|
||||
guest.arch = arch.X86_64
|
||||
guest.arch = fields.Architecture.X86_64
|
||||
guest.domtype = ["kvm"]
|
||||
caps.guests.append(guest)
|
||||
|
||||
guest = vconfig.LibvirtConfigGuest()
|
||||
guest.ostype = vm_mode.HVM
|
||||
guest.arch = arch.I686
|
||||
guest.arch = fields.Architecture.I686
|
||||
guest.domtype = ["kvm"]
|
||||
caps.guests.append(guest)
|
||||
|
||||
|
@ -12327,7 +12339,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
want = {"vendor": "AMD",
|
||||
"features": set(["extapic", "3dnow"]),
|
||||
"model": "Opteron_G4",
|
||||
"arch": arch.X86_64,
|
||||
"arch": fields.Architecture.X86_64,
|
||||
"topology": {"cells": 1, "cores": 2, "threads": 1,
|
||||
"sockets": 4}}
|
||||
got = drvr._get_cpu_info()
|
||||
|
@ -12562,7 +12574,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = arch.X86_64
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = self._fake_caps_numa_topology()
|
||||
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
|
||||
|
@ -12637,7 +12649,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = arch.X86_64
|
||||
caps.host.cpu.arch = fields.Architecture.X86_64
|
||||
caps.host.topology = None
|
||||
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
|
||||
|
@ -13461,13 +13473,13 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
|
||||
guest = vconfig.LibvirtConfigGuest()
|
||||
guest.ostype = 'hvm'
|
||||
guest.arch = arch.X86_64
|
||||
guest.arch = fields.Architecture.X86_64
|
||||
guest.domtype = ['kvm', 'qemu']
|
||||
caps.guests.append(guest)
|
||||
|
||||
guest = vconfig.LibvirtConfigGuest()
|
||||
guest.ostype = 'hvm'
|
||||
guest.arch = arch.I686
|
||||
guest.arch = fields.Architecture.I686
|
||||
guest.domtype = ['kvm']
|
||||
caps.guests.append(guest)
|
||||
|
||||
|
@ -13476,9 +13488,9 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
self.stubs.Set(host.Host, "get_capabilities",
|
||||
get_host_capabilities_stub)
|
||||
|
||||
want = [(arch.X86_64, 'kvm', 'hvm'),
|
||||
(arch.X86_64, 'qemu', 'hvm'),
|
||||
(arch.I686, 'kvm', 'hvm')]
|
||||
want = [(fields.Architecture.X86_64, 'kvm', 'hvm'),
|
||||
(fields.Architecture.X86_64, 'qemu', 'hvm'),
|
||||
(fields.Architecture.I686, 'kvm', 'hvm')]
|
||||
got = drvr._get_instance_capabilities()
|
||||
self.assertEqual(want, got)
|
||||
|
||||
|
@ -15080,8 +15092,8 @@ class HostStateTestCase(test.NoDBTestCase):
|
|||
"fxsr", "clflush", "pse36", "pat", "cmov", "mca", "pge",
|
||||
"mtrr", "sep", "apic"],
|
||||
"topology": {"cores": "1", "threads": "1", "sockets": "1"}}
|
||||
instance_caps = [(arch.X86_64, "kvm", "hvm"),
|
||||
(arch.I686, "kvm", "hvm")]
|
||||
instance_caps = [(fields.Architecture.X86_64, "kvm", "hvm"),
|
||||
(fields.Architecture.I686, "kvm", "hvm")]
|
||||
pci_devices = [{
|
||||
"dev_id": "pci_0000_04_00_3",
|
||||
"address": "0000:04:10.3",
|
||||
|
@ -15173,7 +15185,7 @@ class HostStateTestCase(test.NoDBTestCase):
|
|||
cpu_info = jsonutils.loads(stats["cpu_info"])
|
||||
self.assertEqual(cpu_info,
|
||||
{"vendor": "Intel", "model": "pentium",
|
||||
"arch": arch.I686,
|
||||
"arch": fields.Architecture.I686,
|
||||
"features": ["ssse3", "monitor", "pni", "sse2", "sse",
|
||||
"fxsr", "clflush", "pse36", "pat", "cmov",
|
||||
"mca", "pge", "mtrr", "sep", "apic"],
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
from lxml import etree
|
||||
import six
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova import test
|
||||
import nova.tests.unit.virt.libvirt.fakelibvirt as libvirt
|
||||
|
||||
|
@ -96,7 +96,8 @@ class FakeLibvirtTests(test.NoDBTestCase):
|
|||
def test_getInfo(self):
|
||||
conn_method = self.get_openAuth_curry_func(readOnly=True)
|
||||
res = conn_method(None).getInfo()
|
||||
self.assertIn(res[0], (arch.I686, arch.X86_64))
|
||||
self.assertIn(res[0], (obj_fields.Architecture.I686,
|
||||
obj_fields.Architecture.X86_64))
|
||||
self.assertTrue(1024 <= res[1] <= 16384,
|
||||
"Memory unusually high or low.")
|
||||
self.assertTrue(1 <= res[2] <= 32,
|
||||
|
|
|
@ -21,9 +21,9 @@ from eventlet import greenthread
|
|||
import mock
|
||||
import six
|
||||
|
||||
from nova.compute import arch
|
||||
from nova import exception
|
||||
from nova import objects
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova import test
|
||||
from nova.tests.unit.virt.libvirt import fakelibvirt
|
||||
from nova.virt import event
|
||||
|
@ -870,7 +870,7 @@ Active: 8381604 kB
|
|||
mock.patch('sys.platform', 'linux2'),
|
||||
) as (mock_file, mock_conn, mock_platform):
|
||||
mock_conn().getInfo.return_value = [
|
||||
arch.X86_64, 15814, 8, 1208, 1, 1, 4, 2]
|
||||
obj_fields.Architecture.X86_64, 15814, 8, 1208, 1, 1, 4, 2]
|
||||
|
||||
self.assertEqual(6866, self.host.get_memory_mb_used())
|
||||
|
||||
|
@ -917,7 +917,7 @@ Active: 8381604 kB
|
|||
libvirt_guest.Guest(DiagFakeDomain(1, 750)),
|
||||
libvirt_guest.Guest(DiagFakeDomain(2, 1042))]
|
||||
mock_conn.getInfo.return_value = [
|
||||
arch.X86_64, 15814, 8, 1208, 1, 1, 4, 2]
|
||||
obj_fields.Architecture.X86_64, 15814, 8, 1208, 1, 1, 4, 2]
|
||||
|
||||
self.assertEqual(8657, self.host.get_memory_mb_used())
|
||||
mock_list.assert_called_with(only_guests=False)
|
||||
|
|
|
@ -23,10 +23,10 @@ from oslo_config import cfg
|
|||
from oslo_utils import fileutils
|
||||
import six
|
||||
|
||||
from nova.compute import arch
|
||||
from nova import context
|
||||
from nova import exception
|
||||
from nova import objects
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova import test
|
||||
from nova.tests.unit import fake_instance
|
||||
from nova.tests import uuidsentinel as uuids
|
||||
|
@ -723,7 +723,7 @@ disk size: 4.4M
|
|||
image_meta = objects.ImageMeta.from_dict(
|
||||
{'properties': {'architecture': "X86_64"}})
|
||||
image_arch = libvirt_utils.get_arch(image_meta)
|
||||
self.assertEqual(arch.X86_64, image_arch)
|
||||
self.assertEqual(obj_fields.Architecture.X86_64, image_arch)
|
||||
|
||||
def test_update_mtime_error(self):
|
||||
with mock.patch.object(libvirt_utils, 'execute',
|
||||
|
|
|
@ -15,7 +15,7 @@ import platform
|
|||
import mock
|
||||
from os_brick.initiator import connector
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova.tests.unit.virt.libvirt.volume import test_volume
|
||||
from nova.virt.libvirt.volume import fibrechannel
|
||||
|
||||
|
@ -35,11 +35,13 @@ class LibvirtFibreChannelVolumeDriverTestCase(
|
|||
self.assertIsInstance(libvirt_driver.connector,
|
||||
connector.FibreChannelConnectorS390X)
|
||||
|
||||
@mock.patch.object(platform, 'machine', return_value=arch.S390)
|
||||
@mock.patch.object(platform, 'machine',
|
||||
return_value=obj_fields.Architecture.S390)
|
||||
def test_libvirt_fibrechan_driver_s390(self, mock_machine):
|
||||
self._test_libvirt_fibrechan_driver_s390()
|
||||
|
||||
@mock.patch.object(platform, 'machine', return_value=arch.S390X)
|
||||
@mock.patch.object(platform, 'machine',
|
||||
return_value=obj_fields.Architecture.S390X)
|
||||
def test_libvirt_fibrechan_driver_s390x(self, mock_machine):
|
||||
self._test_libvirt_fibrechan_driver_s390()
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import math
|
|||
import mock
|
||||
from oslo_utils import units
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova.tests.unit.virt.xenapi import stubs
|
||||
from nova.virt import driver
|
||||
from nova.virt import fake
|
||||
|
@ -42,7 +42,7 @@ class XenAPIDriverTestCase(stubs.XenAPITestBaseNoDB):
|
|||
'disk_used': 2 * units.Gi,
|
||||
'disk_allocated': 4 * units.Gi,
|
||||
'host_hostname': 'somename',
|
||||
'supported_instances': arch.X86_64,
|
||||
'supported_instances': obj_fields.Architecture.X86_64,
|
||||
'host_cpu_info': {'cpu_count': 50},
|
||||
'cpu_model': {
|
||||
'vendor': 'GenuineIntel',
|
||||
|
|
|
@ -34,7 +34,6 @@ import six
|
|||
import testtools
|
||||
|
||||
from nova.compute import api as compute_api
|
||||
from nova.compute import arch
|
||||
from nova.compute import hv_type
|
||||
from nova.compute import power_state
|
||||
from nova.compute import task_states
|
||||
|
@ -47,6 +46,7 @@ from nova import db
|
|||
from nova import exception
|
||||
from nova import objects
|
||||
from nova.objects import base
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova import test
|
||||
from nova.tests.unit.api.openstack import fakes
|
||||
from nova.tests.unit.db import fakes as db_fakes
|
||||
|
@ -2276,18 +2276,20 @@ class ToSupportedInstancesTestCase(test.NoDBTestCase):
|
|||
host.to_supported_instances(None))
|
||||
|
||||
def test_return_value(self):
|
||||
self.assertEqual([(arch.X86_64, hv_type.XEN, 'xen')],
|
||||
host.to_supported_instances([u'xen-3.0-x86_64']))
|
||||
self.assertEqual(
|
||||
[(obj_fields.Architecture.X86_64, hv_type.XEN, 'xen')],
|
||||
host.to_supported_instances([u'xen-3.0-x86_64']))
|
||||
|
||||
def test_invalid_values_do_not_break(self):
|
||||
self.assertEqual([(arch.X86_64, hv_type.XEN, 'xen')],
|
||||
host.to_supported_instances([u'xen-3.0-x86_64', 'spam']))
|
||||
self.assertEqual(
|
||||
[(obj_fields.Architecture.X86_64, hv_type.XEN, 'xen')],
|
||||
host.to_supported_instances([u'xen-3.0-x86_64', 'spam']))
|
||||
|
||||
def test_multiple_values(self):
|
||||
self.assertEqual(
|
||||
[
|
||||
(arch.X86_64, hv_type.XEN, 'xen'),
|
||||
(arch.I686, hv_type.XEN, 'hvm')
|
||||
(obj_fields.Architecture.X86_64, hv_type.XEN, 'xen'),
|
||||
(obj_fields.Architecture.I686, hv_type.XEN, 'hvm')
|
||||
],
|
||||
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_utils import versionutils
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.compute import hv_type
|
||||
from nova.compute import power_state
|
||||
from nova.compute import task_states
|
||||
|
@ -39,6 +38,7 @@ import nova.conf
|
|||
from nova.console import type as ctype
|
||||
from nova import exception
|
||||
from nova.i18n import _LW
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova.virt import diagnostics
|
||||
from nova.virt import driver
|
||||
from nova.virt import hardware
|
||||
|
@ -142,13 +142,14 @@ class FakeDriver(driver.ComputeDriver):
|
|||
memory_mb=self.memory_mb,
|
||||
local_gb=self.local_gb)
|
||||
self.host_status_base = {
|
||||
'hypervisor_type': 'fake',
|
||||
'hypervisor_version': versionutils.convert_version_to_int('1.0'),
|
||||
'hypervisor_hostname': CONF.host,
|
||||
'cpu_info': {},
|
||||
'disk_available_least': 0,
|
||||
'supported_instances': [(arch.X86_64, hv_type.FAKE, vm_mode.HVM)],
|
||||
'numa_topology': None,
|
||||
'hypervisor_type': 'fake',
|
||||
'hypervisor_version': versionutils.convert_version_to_int('1.0'),
|
||||
'hypervisor_hostname': CONF.host,
|
||||
'cpu_info': {},
|
||||
'disk_available_least': 0,
|
||||
'supported_instances': [(
|
||||
obj_fields.Architecture.X86_64, hv_type.FAKE, vm_mode.HVM)],
|
||||
'numa_topology': None,
|
||||
}
|
||||
self._mounts = {}
|
||||
self._interfaces = {}
|
||||
|
|
|
@ -20,8 +20,8 @@ Constants used in ops classes
|
|||
from os_win import constants
|
||||
from oslo_utils import units
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.compute import power_state
|
||||
from nova.objects import fields as obj_fields
|
||||
|
||||
HYPERV_POWER_STATE = {
|
||||
constants.HYPERV_VM_STATE_DISABLED: power_state.SHUTDOWN,
|
||||
|
@ -32,13 +32,13 @@ HYPERV_POWER_STATE = {
|
|||
}
|
||||
|
||||
WMI_WIN32_PROCESSOR_ARCHITECTURE = {
|
||||
constants.ARCH_I686: arch.I686,
|
||||
constants.ARCH_MIPS: arch.MIPS,
|
||||
constants.ARCH_ALPHA: arch.ALPHA,
|
||||
constants.ARCH_PPC: arch.PPC,
|
||||
constants.ARCH_ARMV7: arch.ARMV7,
|
||||
constants.ARCH_IA64: arch.IA64,
|
||||
constants.ARCH_X86_64: arch.X86_64,
|
||||
constants.ARCH_I686: obj_fields.Architecture.I686,
|
||||
constants.ARCH_MIPS: obj_fields.Architecture.MIPS,
|
||||
constants.ARCH_ALPHA: obj_fields.Architecture.ALPHA,
|
||||
constants.ARCH_PPC: obj_fields.Architecture.PPC,
|
||||
constants.ARCH_ARMV7: obj_fields.Architecture.ARMV7,
|
||||
constants.ARCH_IA64: obj_fields.Architecture.IA64,
|
||||
constants.ARCH_X86_64: obj_fields.Architecture.X86_64,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ from oslo_log import log as logging
|
|||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import units
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.compute import hv_type
|
||||
from nova.compute import vm_mode
|
||||
import nova.conf
|
||||
from nova.i18n import _
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova.virt.hyperv import constants
|
||||
from nova.virt.hyperv import pathutils
|
||||
|
||||
|
@ -157,9 +157,10 @@ class HostOps(object):
|
|||
'hypervisor_hostname': platform.node(),
|
||||
'vcpus_used': 0,
|
||||
'cpu_info': jsonutils.dumps(cpu_info),
|
||||
'supported_instances':
|
||||
[(arch.I686, hv_type.HYPERV, vm_mode.HVM),
|
||||
(arch.X86_64, hv_type.HYPERV, vm_mode.HVM)],
|
||||
'supported_instances': [
|
||||
(obj_fields.Architecture.I686, hv_type.HYPERV, vm_mode.HVM),
|
||||
(obj_fields.Architecture.X86_64, hv_type.HYPERV,
|
||||
vm_mode.HVM)],
|
||||
'numa_topology': None,
|
||||
}
|
||||
|
||||
|
|
|
@ -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 arch
|
||||
from nova.compute import hv_type
|
||||
from nova.compute import power_state
|
||||
from nova.compute import task_states
|
||||
|
@ -50,6 +49,7 @@ from nova.i18n import _LE
|
|||
from nova.i18n import _LI
|
||||
from nova.i18n import _LW
|
||||
from nova import objects
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova import servicegroup
|
||||
from nova.virt import configdrive
|
||||
from nova.virt import driver as virt_driver
|
||||
|
@ -223,7 +223,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
|||
|
||||
raw_cpu_arch = node.properties.get('cpu_arch', None)
|
||||
try:
|
||||
cpu_arch = arch.canonicalize(raw_cpu_arch)
|
||||
cpu_arch = obj_fields.Architecture.canonicalize(raw_cpu_arch)
|
||||
except exception.InvalidArchitectureName:
|
||||
cpu_arch = None
|
||||
if not cpu_arch:
|
||||
|
|
|
@ -76,11 +76,11 @@ from oslo_config import cfg
|
|||
import six
|
||||
|
||||
from nova import block_device
|
||||
from nova.compute import arch
|
||||
from nova.compute import vm_mode
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
from nova.objects import base as obj_base
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova.virt import configdrive
|
||||
from nova.virt import driver
|
||||
from nova.virt.libvirt import utils as libvirt_utils
|
||||
|
@ -256,8 +256,14 @@ def get_disk_bus_for_device_type(instance,
|
|||
elif virt_type in ("qemu", "kvm"):
|
||||
if device_type == "cdrom":
|
||||
guestarch = libvirt_utils.get_arch(image_meta)
|
||||
if guestarch in (arch.PPC, arch.PPC64, arch.PPCLE, arch.PPC64LE,
|
||||
arch.S390, arch.S390X, arch.AARCH64):
|
||||
if guestarch in (
|
||||
obj_fields.Architecture.PPC,
|
||||
obj_fields.Architecture.PPC64,
|
||||
obj_fields.Architecture.PPCLE,
|
||||
obj_fields.Architecture.PPC64LE,
|
||||
obj_fields.Architecture.S390,
|
||||
obj_fields.Architecture.S390X,
|
||||
obj_fields.Architecture.AARCH64):
|
||||
return "scsi"
|
||||
else:
|
||||
return "ide"
|
||||
|
|
|
@ -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 arch
|
||||
from nova.compute import hv_type
|
||||
from nova.compute import power_state
|
||||
from nova.compute import task_states
|
||||
|
@ -300,18 +299,21 @@ MIN_LIBVIRT_POSTCOPY_VERSION = (1, 3, 3)
|
|||
# qemu postcopy support
|
||||
MIN_QEMU_POSTCOPY_VERSION = (2, 5, 0)
|
||||
|
||||
MIN_LIBVIRT_OTHER_ARCH = {arch.S390: MIN_LIBVIRT_KVM_S390_VERSION,
|
||||
arch.S390X: MIN_LIBVIRT_KVM_S390_VERSION,
|
||||
arch.PPC: MIN_LIBVIRT_KVM_PPC64_VERSION,
|
||||
arch.PPC64: MIN_LIBVIRT_KVM_PPC64_VERSION,
|
||||
arch.PPC64LE: MIN_LIBVIRT_KVM_PPC64_VERSION,
|
||||
}
|
||||
MIN_QEMU_OTHER_ARCH = {arch.S390: MIN_QEMU_S390_VERSION,
|
||||
arch.S390X: MIN_QEMU_S390_VERSION,
|
||||
arch.PPC: MIN_QEMU_PPC64_VERSION,
|
||||
arch.PPC64: MIN_QEMU_PPC64_VERSION,
|
||||
arch.PPC64LE: MIN_QEMU_PPC64_VERSION,
|
||||
}
|
||||
MIN_LIBVIRT_OTHER_ARCH = {
|
||||
fields.Architecture.S390: MIN_LIBVIRT_KVM_S390_VERSION,
|
||||
fields.Architecture.S390X: MIN_LIBVIRT_KVM_S390_VERSION,
|
||||
fields.Architecture.PPC: MIN_LIBVIRT_KVM_PPC64_VERSION,
|
||||
fields.Architecture.PPC64: MIN_LIBVIRT_KVM_PPC64_VERSION,
|
||||
fields.Architecture.PPC64LE: MIN_LIBVIRT_KVM_PPC64_VERSION,
|
||||
}
|
||||
|
||||
MIN_QEMU_OTHER_ARCH = {
|
||||
fields.Architecture.S390: MIN_QEMU_S390_VERSION,
|
||||
fields.Architecture.S390X: MIN_QEMU_S390_VERSION,
|
||||
fields.Architecture.PPC: MIN_QEMU_PPC64_VERSION,
|
||||
fields.Architecture.PPC64: MIN_QEMU_PPC64_VERSION,
|
||||
fields.Architecture.PPC64LE: MIN_QEMU_PPC64_VERSION,
|
||||
}
|
||||
|
||||
# perf events support
|
||||
MIN_LIBVIRT_PERF_VERSION = (2, 0, 0)
|
||||
|
@ -461,7 +463,8 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
caps = self._host.get_capabilities()
|
||||
hostarch = caps.host.cpu.arch
|
||||
if (CONF.libvirt.virt_type not in ('qemu', 'kvm') or
|
||||
hostarch not in (arch.I686, arch.X86_64)):
|
||||
hostarch not in (fields.Architecture.I686,
|
||||
fields.Architecture.X86_64)):
|
||||
LOG.warning(_LW('The libvirt driver is not tested on '
|
||||
'%(type)s/%(arch)s by the OpenStack project and '
|
||||
'thus its quality can not be ensured. For more '
|
||||
|
@ -540,7 +543,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
{'version': self._version_to_string(
|
||||
NEXT_MIN_QEMU_VERSION)})
|
||||
|
||||
kvm_arch = arch.from_host()
|
||||
kvm_arch = fields.Architecture.from_host()
|
||||
if (CONF.libvirt.virt_type in ('kvm', 'qemu') and
|
||||
kvm_arch in MIN_LIBVIRT_OTHER_ARCH and
|
||||
not self._host.has_min_version(
|
||||
|
@ -1013,7 +1016,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
tree = etree.fromstring(xml)
|
||||
|
||||
# The 'serial' device is the base for x86 platforms. Other platforms
|
||||
# (e.g. kvm on system z = arch.S390X) can only use 'console' devices.
|
||||
# (e.g. kvm on system z = S390X) can only use 'console' devices.
|
||||
xpath_mode = "[@mode='%s']" % mode if mode else ""
|
||||
serial_tcp = "./devices/serial[@type='tcp']/source" + xpath_mode
|
||||
console_tcp = "./devices/console[@type='tcp']/source" + xpath_mode
|
||||
|
@ -3701,13 +3704,14 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
else:
|
||||
# For ARM systems we will default to vexpress-a15 for armv7
|
||||
# and virt for aarch64
|
||||
if caps.host.cpu.arch == arch.ARMV7:
|
||||
if caps.host.cpu.arch == fields.Architecture.ARMV7:
|
||||
mach_type = "vexpress-a15"
|
||||
|
||||
if caps.host.cpu.arch == arch.AARCH64:
|
||||
if caps.host.cpu.arch == fields.Architecture.AARCH64:
|
||||
mach_type = "virt"
|
||||
|
||||
if caps.host.cpu.arch in (arch.S390, arch.S390X):
|
||||
if caps.host.cpu.arch in (fields.Architecture.S390,
|
||||
fields.Architecture.S390X):
|
||||
mach_type = 's390-ccw-virtio'
|
||||
|
||||
# If set in the config, use that as the default.
|
||||
|
@ -4066,7 +4070,8 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
clk.add_timer(tmrtc)
|
||||
|
||||
guestarch = libvirt_utils.get_arch(image_meta)
|
||||
if guestarch in (arch.I686, arch.X86_64):
|
||||
if guestarch in (fields.Architecture.I686,
|
||||
fields.Architecture.X86_64):
|
||||
# NOTE(rfolco): HPET is a hardware timer for x86 arch.
|
||||
# qemu -no-hpet is not supported on non-x86 targets.
|
||||
tmhpet = vconfig.LibvirtConfigGuestTimer()
|
||||
|
@ -4089,7 +4094,8 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
def _set_features(self, guest, os_type, caps, virt_type):
|
||||
if virt_type == "xen":
|
||||
# PAE only makes sense in X86
|
||||
if caps.host.cpu.arch in (arch.I686, arch.X86_64):
|
||||
if caps.host.cpu.arch in (fields.Architecture.I686,
|
||||
fields.Architecture.X86_64):
|
||||
guest.features.append(vconfig.LibvirtConfigGuestFeaturePAE())
|
||||
|
||||
if (virt_type not in ("lxc", "uml", "parallels", "xen") or
|
||||
|
@ -4130,7 +4136,9 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
video.type = 'xen'
|
||||
elif CONF.libvirt.virt_type == 'parallels':
|
||||
video.type = 'vga'
|
||||
elif guestarch in (arch.PPC, arch.PPC64, arch.PPC64LE):
|
||||
elif guestarch in (fields.Architecture.PPC,
|
||||
fields.Architecture.PPC64,
|
||||
fields.Architecture.PPC64LE):
|
||||
# NOTE(ldbragst): PowerKVM doesn't support 'cirrus' be default
|
||||
# so use 'vga' instead when running on Power hardware.
|
||||
video.type = 'vga'
|
||||
|
@ -4252,7 +4260,8 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
|
||||
def _has_uefi_support(self):
|
||||
# This means that the host can support uefi booting for guests
|
||||
supported_archs = [arch.X86_64, arch.AARCH64]
|
||||
supported_archs = [fields.Architecture.X86_64,
|
||||
fields.Architecture.AARCH64]
|
||||
caps = self._host.get_capabilities()
|
||||
return ((caps.host.cpu.arch in supported_archs) and
|
||||
self._host.has_min_version(MIN_LIBVIRT_UEFI_VERSION) and
|
||||
|
@ -4293,7 +4302,8 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
if guest.os_type == vm_mode.HVM:
|
||||
guest.os_loader = CONF.libvirt.xen_hvmloader_path
|
||||
elif virt_type in ("kvm", "qemu"):
|
||||
if caps.host.cpu.arch in (arch.I686, arch.X86_64):
|
||||
if caps.host.cpu.arch in (fields.Architecture.I686,
|
||||
fields.Architecture.X86_64):
|
||||
guest.sysinfo = self._get_guest_config_sysinfo(instance)
|
||||
guest.os_smbios = vconfig.LibvirtConfigGuestSMBIOS()
|
||||
hw_firmware_type = image_meta.properties.get('hw_firmware_type')
|
||||
|
@ -4349,7 +4359,8 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
num_ports = hardware.get_number_of_serial_ports(
|
||||
flavor, image_meta)
|
||||
|
||||
if guest_arch in (arch.S390, arch.S390X):
|
||||
if guest_arch in (fields.Architecture.S390,
|
||||
fields.Architecture.S390X):
|
||||
console_cls = vconfig.LibvirtConfigGuestConsole
|
||||
else:
|
||||
console_cls = vconfig.LibvirtConfigGuestSerial
|
||||
|
@ -4370,7 +4381,8 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
# client app is connected. Thus we can't get away
|
||||
# with a single type=pty console. Instead we have
|
||||
# to configure two separate consoles.
|
||||
if guest_arch in (arch.S390, arch.S390X):
|
||||
if guest_arch in (fields.Architecture.S390,
|
||||
fields.Architecture.S390X):
|
||||
consolelog = vconfig.LibvirtConfigGuestConsole()
|
||||
consolelog.target_type = "sclplm"
|
||||
else:
|
||||
|
@ -4378,7 +4390,8 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
consolelog.type = "file"
|
||||
consolelog.source_path = log_path
|
||||
guest.add_device(consolelog)
|
||||
if caps.host.cpu.arch in (arch.S390, arch.S390X):
|
||||
if caps.host.cpu.arch in (fields.Architecture.S390,
|
||||
fields.Architecture.S390X):
|
||||
consolepty = vconfig.LibvirtConfigGuestConsole()
|
||||
consolepty.target_type = "sclp"
|
||||
else:
|
||||
|
@ -5031,7 +5044,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
for g in caps.guests:
|
||||
for dt in g.domtype:
|
||||
instance_cap = (
|
||||
arch.canonicalize(g.arch),
|
||||
fields.Architecture.canonicalize(g.arch),
|
||||
hv_type.canonicalize(dt),
|
||||
vm_mode.canonicalize(g.ostype))
|
||||
instance_caps.append(instance_cap)
|
||||
|
@ -5187,10 +5200,12 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
self._bad_libvirt_numa_version_warn = True
|
||||
return False
|
||||
|
||||
support_matrix = {(arch.I686, arch.X86_64,
|
||||
arch.AARCH64): MIN_LIBVIRT_NUMA_VERSION,
|
||||
(arch.PPC64,
|
||||
arch.PPC64LE): MIN_LIBVIRT_NUMA_VERSION_PPC}
|
||||
support_matrix = {
|
||||
(fields.Architecture.I686,
|
||||
fields.Architecture.X86_64,
|
||||
fields.Architecture.AARCH64): MIN_LIBVIRT_NUMA_VERSION,
|
||||
(fields.Architecture.PPC64,
|
||||
fields.Architecture.PPC64LE): MIN_LIBVIRT_NUMA_VERSION_PPC}
|
||||
caps = self._host.get_capabilities()
|
||||
is_supported = False
|
||||
for archs, libvirt_ver in support_matrix.items():
|
||||
|
@ -5204,8 +5219,11 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
def _has_hugepage_support(self):
|
||||
# This means that the host can support multiple values for the size
|
||||
# field in LibvirtConfigGuestMemoryBackingPage
|
||||
supported_archs = [arch.I686, arch.X86_64, arch.PPC64LE, arch.PPC64,
|
||||
arch.AARCH64]
|
||||
supported_archs = [fields.Architecture.I686,
|
||||
fields.Architecture.X86_64,
|
||||
fields.Architecture.AARCH64,
|
||||
fields.Architecture.PPC64LE,
|
||||
fields.Architecture.PPC64]
|
||||
caps = self._host.get_capabilities()
|
||||
return ((caps.host.cpu.arch in supported_archs) and
|
||||
self._host.has_min_version(MIN_LIBVIRT_HUGEPAGE_VERSION,
|
||||
|
|
|
@ -26,12 +26,12 @@ from lxml import etree
|
|||
from oslo_concurrency import processutils
|
||||
from oslo_log import log as logging
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.compute import vm_mode
|
||||
import nova.conf
|
||||
from nova.i18n import _
|
||||
from nova.i18n import _LI
|
||||
from nova.i18n import _LW
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova import utils
|
||||
from nova.virt import images
|
||||
from nova.virt.libvirt import config as vconfig
|
||||
|
@ -498,7 +498,7 @@ def get_arch(image_meta):
|
|||
if image_arch is not None:
|
||||
return image_arch
|
||||
|
||||
return arch.from_host()
|
||||
return obj_fields.Architecture.from_host()
|
||||
|
||||
|
||||
def is_mounted(mount_path, source=None):
|
||||
|
|
|
@ -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 arch
|
||||
from nova.compute import hv_type
|
||||
from nova.compute import vm_mode
|
||||
import nova.conf
|
||||
|
@ -30,6 +29,7 @@ from nova import context
|
|||
from nova import exception
|
||||
from nova.i18n import _LW
|
||||
from nova import objects
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova.virt.vmwareapi import ds_util
|
||||
from nova.virt.vmwareapi import vim_util
|
||||
from nova.virt.vmwareapi import vm_util
|
||||
|
@ -98,8 +98,8 @@ class VCState(object):
|
|||
str(about_info.version))
|
||||
data["hypervisor_hostname"] = self._host_name
|
||||
data["supported_instances"] = [
|
||||
(arch.I686, hv_type.VMWARE, vm_mode.HVM),
|
||||
(arch.X86_64, hv_type.VMWARE, vm_mode.HVM)]
|
||||
(obj_fields.Architecture.I686, hv_type.VMWARE, vm_mode.HVM),
|
||||
(obj_fields.Architecture.X86_64, hv_type.VMWARE, vm_mode.HVM)]
|
||||
|
||||
self._stats = data
|
||||
if self._auto_service_disabled:
|
||||
|
|
|
@ -24,7 +24,6 @@ from oslo_log import log as logging
|
|||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from nova.compute import arch
|
||||
from nova.compute import hv_type
|
||||
from nova.compute import task_states
|
||||
from nova.compute import vm_mode
|
||||
|
@ -33,6 +32,7 @@ from nova import context
|
|||
from nova import exception
|
||||
from nova.i18n import _, _LE, _LI, _LW
|
||||
from nova import objects
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova.virt.xenapi import pool_states
|
||||
from nova.virt.xenapi import vm_utils
|
||||
|
||||
|
@ -285,7 +285,7 @@ def to_supported_instances(host_capabilities):
|
|||
|
||||
ostype, _version, guestarch = capability.split("-")
|
||||
|
||||
guestarch = arch.canonicalize(guestarch)
|
||||
guestarch = obj_fields.Architecture.canonicalize(guestarch)
|
||||
ostype = vm_mode.canonicalize(ostype)
|
||||
|
||||
result.append((guestarch, hv_type.XEN, ostype))
|
||||
|
|
Loading…
Reference in New Issue